Skip to content

Commit aca4bf9

Browse files
Add zstd compression to SAPM receiver and exporter
- Updated github.com/signalfx/sapm-proto to v0.13.0. - Added "compression" config setting to sapm exporter. - Added tests to verify various compression settings for sapm receiver and exporter.
1 parent 8faa947 commit aca4bf9

File tree

25 files changed

+299
-63
lines changed

25 files changed

+299
-63
lines changed

.chloggen/sapm-exporter-zstd.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: enhancement
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: sapmexporter
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: sapm exporter now supports `compression` config option to specify either gzip or zstd compression to use.
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [23257]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

.chloggen/sapm-receiver-zstd.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: enhancement
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: sapmreceiver
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: sapm receiver now accepts requests in compressed with zstd.
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [23257]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

cmd/configschema/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ require (
555555
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 // indirect
556556
github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 // indirect
557557
github.com/signalfx/golib/v3 v3.3.47 // indirect
558-
github.com/signalfx/sapm-proto v0.12.0 // indirect
558+
github.com/signalfx/sapm-proto v0.13.0 // indirect
559559
github.com/sijms/go-ora/v2 v2.7.6 // indirect
560560
github.com/sirupsen/logrus v1.9.0 // indirect
561561
github.com/snowflakedb/gosnowflake v1.6.18 // indirect

cmd/configschema/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/otelcontribcol/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ require (
572572
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 // indirect
573573
github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 // indirect
574574
github.com/signalfx/golib/v3 v3.3.47 // indirect
575-
github.com/signalfx/sapm-proto v0.12.0 // indirect
575+
github.com/signalfx/sapm-proto v0.13.0 // indirect
576576
github.com/signalfx/signalfx-agent/pkg/apm v0.0.0-20230214151822-6a6813cf5bf1 // indirect
577577
github.com/sijms/go-ora/v2 v2.7.6 // indirect
578578
github.com/sirupsen/logrus v1.9.0 // indirect

cmd/otelcontribcol/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/oteltestbedcol/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ require (
200200
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 // indirect
201201
github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 // indirect
202202
github.com/signalfx/golib/v3 v3.3.47 // indirect
203-
github.com/signalfx/sapm-proto v0.12.0 // indirect
203+
github.com/signalfx/sapm-proto v0.13.0 // indirect
204204
github.com/signalfx/signalfx-agent/pkg/apm v0.0.0-20230214151822-6a6813cf5bf1 // indirect
205205
github.com/soheilhy/cmux v0.1.5 // indirect
206206
github.com/spf13/cobra v1.7.0 // indirect

cmd/oteltestbedcol/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/sapmexporter/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ during final translation. Intended to be used in tandem with identical configur
4848
- `timeout` (default = 5s): Is the timeout for every attempt to send data to the backend.
4949
- `log_detailed_response` (default = `false`): Option to log detailed response from Splunk APM.
5050
In addition to setting this option to `true`, debug logging at the Collector level needs to be enabled.
51+
- `compression`: Compression method to use for outgoing SAPM requests. Can be one of
52+
"gzip", "zstd" or be unspecified. If unspecified then "gzip" compression is used unless
53+
`disable_compression` option is set to true.
54+
- `disable_compression` (default = `false`): If set to true the outgoing requests are not
55+
compressed and `compression` option is ignored.
5156

5257
In addition, this exporter offers queued retry which is enabled by default.
5358
Information about queued retry configuration parameters can be found

exporter/sapmexporter/config.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package sapmexporter // import "github.com/open-telemetry/opentelemetry-collecto
55

66
import (
77
"errors"
8+
"fmt"
89
"net/url"
910

1011
sapmclient "github.com/signalfx/sapm-proto/client"
@@ -35,9 +36,13 @@ type Config struct {
3536
// MaxConnections is used to set a limit to the maximum idle HTTP connection the exporter can keep open.
3637
MaxConnections uint `mapstructure:"max_connections"`
3738

38-
// Disable GZip compression.
39+
// Disable compression. If set to true then Compression field is ignored.
3940
DisableCompression bool `mapstructure:"disable_compression"`
4041

42+
// Compression method to use (gzip or zstd). Ignored if DisableCompression=true.
43+
// If unspecified defaults to gzip.
44+
Compression string `mapstructure:"compression"`
45+
4146
// Log detailed response from trace ingest.
4247
LogDetailedResponse bool `mapstructure:"log_detailed_response"`
4348

@@ -56,6 +61,17 @@ func (c *Config) Validate() error {
5661
if err != nil {
5762
return err
5863
}
64+
65+
switch c.Compression {
66+
// Valid compression methods.
67+
case "", // no compression
68+
string(sapmclient.CompressionMethodGzip),
69+
string(sapmclient.CompressionMethodZstd):
70+
71+
default:
72+
return fmt.Errorf("invalid compression %q", c.Compression)
73+
}
74+
5975
return nil
6076
}
6177

@@ -85,5 +101,9 @@ func (c *Config) clientOptions() []sapmclient.Option {
85101
opts = append(opts, sapmclient.WithDisabledCompression())
86102
}
87103

104+
if c.Compression != "" {
105+
opts = append(opts, sapmclient.WithCompressionMethod(sapmclient.CompressionMethod(c.Compression)))
106+
}
107+
88108
return opts
89109
}

0 commit comments

Comments
 (0)