Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporters/datadogexporter: deprecate SampleRate #9771

Merged
merged 1 commit into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

- `cumulativetodeltaprocessor`: Deprecated `metrics` configuration option in favor of `include` and `exclude` (#8952)
- `datadogexporter`: Deprecate `metrics::report_quantiles` in favor of `metrics::summaries::mode` (#8846)
- `datadogexporter`: Deprecate `traces.sample_rate` setting. It was never used anywhere. (#9771)

### 🚀 New components 🚀

Expand Down
5 changes: 4 additions & 1 deletion exporter/datadogexporter/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ type TracesConfig struct {
// SampleRate is the rate at which to sample this event. Default is 1,
// meaning no sampling. If you want to send one event out of every 250
// times Send() is called, you would specify 250 here.
// Deprecated: [v0.50.0] Not used anywhere.
SampleRate uint `mapstructure:"sample_rate"`

// ignored resources
Expand Down Expand Up @@ -532,6 +533,8 @@ func (c *Config) Unmarshal(configMap *config.Map) error {
if c.Env != "" {
c.warnings = append(c.warnings, fmt.Errorf(deprecationTemplate, "env", "v0.52.0", 9016))
}

if c.Traces.SampleRate != 0 {
c.warnings = append(c.warnings, fmt.Errorf(deprecationTemplate, "traces.sample_rate", "v0.52.0", 9771))
}
return nil
}
1 change: 0 additions & 1 deletion exporter/datadogexporter/config/warn_envvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func futureDefaultConfig() *Config {
},
},
Traces: TracesConfig{
SampleRate: 1,
IgnoreResources: []string{},
},
HostMetadata: HostMetadataConfig{
Expand Down
7 changes: 0 additions & 7 deletions exporter/datadogexporter/example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ exporters:
## Trace exporter specific configuration.
#
# traces:
## @param sample_rate - integer - optional - default: 1
# The rate at which to sample traces. Default is 1 (Always Sample),
# meaning no sampling. If you want to send one event out of every 250
# you would specify 250.
#
# sample_rate: 1

## @param endpoint - string - optional
## The host of the Datadog intake server to send traces to.
## If unset it will be determined from the `DD_APM_URL` environment variable (Deprecated: [v0.47.0] set environment variable explicitly on configuration instead).
Expand Down
1 change: 0 additions & 1 deletion exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func (*factory) createDefaultConfig() config.Exporter {
},

Traces: ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: os.Getenv("DD_APM_URL"), // If not provided, set during config sanitization
},
Expand Down
5 changes: 0 additions & 5 deletions exporter/datadogexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func TestCreateDefaultConfig(t *testing.T) {
},

Traces: ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: "APM_URL",
},
Expand Down Expand Up @@ -176,7 +175,6 @@ func TestLoadConfig(t *testing.T) {
},
}, apiConfig.Metrics)
assert.Equal(t, ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: "https://trace.agent.datadoghq.eu",
},
Expand Down Expand Up @@ -230,7 +228,6 @@ func TestLoadConfig(t *testing.T) {
},

Traces: ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: "https://trace.agent.datadoghq.com",
},
Expand Down Expand Up @@ -332,7 +329,6 @@ func TestLoadConfigEnvVariables(t *testing.T) {
}, apiConfig.Metrics)
assert.Equal(t,
ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: "https://trace.agent.datadoghq.test",
},
Expand Down Expand Up @@ -385,7 +381,6 @@ func TestLoadConfigEnvVariables(t *testing.T) {
},
}, defaultConfig.Metrics)
assert.Equal(t, ddconfig.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: "https://trace.agent.datadoghq.com",
},
Expand Down
4 changes: 0 additions & 4 deletions exporter/datadogexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ exporters:
site: datadoghq.eu
fail_on_invalid_key: true

traces:
sample_rate: 1

datadog/api2:
hostname: customhostname

Expand All @@ -42,7 +39,6 @@ exporters:
report_quantiles: false

traces:
sample_rate: 1
endpoint: https://trace.agent.datadoghq.test

datadog/default:
Expand Down
4 changes: 1 addition & 3 deletions exporter/datadogexporter/traces_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func testTracesExporterHelper(td ptrace.Traces, t *testing.T) []string {
},
},
Traces: config.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{
Endpoint: server.URL,
},
Expand Down Expand Up @@ -187,8 +186,7 @@ func TestPushTraceData(t *testing.T) {
TCPAddr: confignet.TCPAddr{Endpoint: server.URL},
},
Traces: config.TracesConfig{
SampleRate: 1,
TCPAddr: confignet.TCPAddr{Endpoint: server.URL},
TCPAddr: confignet.TCPAddr{Endpoint: server.URL},
},

HostMetadata: config.HostMetadataConfig{
Expand Down