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

[exporter/datadog] Remove deprecated peer_service_aggregation #34177

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions .chloggen/dd-exporter-remove-cfg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: datadogexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Remove deprecated config `peer_service_aggregation`"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [34177]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: "Use `peer_tags_aggregation` instead"

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
12 changes: 5 additions & 7 deletions exporter/datadogexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ type TracesConfig struct {
// The default value is `false`.
ComputeTopLevelBySpanKind bool `mapstructure:"compute_top_level_by_span_kind"`

// If set to true, enables `peer.service` aggregation in the exporter. If disabled, aggregated trace stats will not include `peer.service` as a dimension.
// For the best experience with `peer.service`, it is recommended to also enable `compute_stats_by_span_kind`.
// If enabling both causes the datadog exporter to consume too many resources, try disabling `compute_stats_by_span_kind` first.
// If the overhead remains high, it will be due to a high cardinality of `peer.service` values from the traces. You may need to check your instrumentation.
// Deprecated: Please use PeerTagsAggregation instead
PeerServiceAggregation bool `mapstructure:"peer_service_aggregation"`

// If set to true, enables aggregation of peer related tags (e.g., `peer.service`, `db.instance`, etc.) in the datadog exporter.
// If disabled, aggregated trace stats will not include these tags as dimensions on trace metrics.
// For the best experience with peer tags, Datadog also recommends enabling `compute_stats_by_span_kind`.
Expand Down Expand Up @@ -581,6 +574,11 @@ var removedSettings = []renameError{
newName: "metrics::instrumentation_scope_as_tags",
issueNumber: 11135,
},
{
oldName: "traces::peer_service_aggregation",
newName: "traces::peer_tags_aggregation",
issueNumber: 34177,
},
}

// Error implements the error interface.
Expand Down
9 changes: 9 additions & 0 deletions exporter/datadogexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ func TestUnmarshal(t *testing.T) {
}),
err: "\"metrics::instrumentation_library_metadata_as_tags\" was removed in favor of \"metrics::instrumentation_scope_as_tags\". See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/11135",
},
{
name: "peer_service_aggregation custom error",
configMap: confmap.NewFromStringMap(map[string]any{
"traces": map[string]any{
"peer_service_aggregation": true,
},
}),
err: "\"traces::peer_service_aggregation\" was removed in favor of \"traces::peer_tags_aggregation\". See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34177",
},
{
name: "Empty metric endpoint",
configMap: confmap.NewFromStringMap(map[string]any{
Expand Down
7 changes: 0 additions & 7 deletions exporter/datadogexporter/config_warnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ var renamedSettings = []deprecatedError{
c.Metrics.HistConfig.SendAggregations = c.Metrics.HistConfig.SendCountSum
},
},
{
oldName: "traces::peer_service_aggregation",
newName: "traces::peer_tags_aggregation",
updateFn: func(c *Config) {
c.Traces.PeerTagsAggregation = c.Traces.PeerServiceAggregation
},
},
}

// Error implements the error interface.
Expand Down
77 changes: 0 additions & 77 deletions exporter/datadogexporter/config_warnings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,80 +94,3 @@ func TestSendAggregations(t *testing.T) {
}

}

func TestPeerTags(t *testing.T) {
tests := []struct {
name string
cfgMap *confmap.Conf
expectedPeerTagsValue bool
warnings []string
err string
}{
{
name: "both traces::peer_service_aggregation and traces::peer_tags_aggregation",
cfgMap: confmap.NewFromStringMap(map[string]any{
"traces": map[string]any{
"peer_service_aggregation": true,
"peer_tags_aggregation": true,
},
}),
err: "\"traces::peer_service_aggregation\" and \"traces::peer_tags_aggregation\" can't be both set at the same time: use \"traces::peer_tags_aggregation\" only instead",
},
{
name: "traces::peer_service_aggregation set to true",
cfgMap: confmap.NewFromStringMap(map[string]any{
"traces": map[string]any{
"peer_service_aggregation": true,
},
}),
expectedPeerTagsValue: true,
warnings: []string{
"\"traces::peer_service_aggregation\" has been deprecated in favor of \"traces::peer_tags_aggregation\"",
},
},
{
name: "traces::peer_service_aggregation set to false",
cfgMap: confmap.NewFromStringMap(map[string]any{
"traces": map[string]any{
"peer_service_aggregation": false,
},
}),
warnings: []string{
"\"traces::peer_service_aggregation\" has been deprecated in favor of \"traces::peer_tags_aggregation\"",
},
},
{
name: "traces::peer_service_aggregation and traces::peer_tags_aggregation unset",
cfgMap: confmap.New(),
expectedPeerTagsValue: false,
},
{
name: "traces::peer_tags_aggregation set",
cfgMap: confmap.NewFromStringMap(map[string]any{
"traces": map[string]any{
"peer_tags_aggregation": true,
},
}),
expectedPeerTagsValue: true,
},
}

for _, testInstance := range tests {
t.Run(testInstance.name, func(t *testing.T) {
f := NewFactory()
cfg := f.CreateDefaultConfig().(*Config)
err := testInstance.cfgMap.Unmarshal(cfg)
if err != nil || testInstance.err != "" {
assert.ErrorContains(t, err, testInstance.err)
} else {
assert.Equal(t, testInstance.expectedPeerTagsValue, cfg.Traces.PeerTagsAggregation)
var warningStr []string
for _, warning := range cfg.warnings {
warningStr = append(warningStr, warning.Error())
}
assert.ElementsMatch(t, testInstance.warnings, warningStr)
}
})
}

}
9 changes: 0 additions & 9 deletions exporter/datadogexporter/examples/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,6 @@ exporters:
## Enabling this config option may increase the number of spans that generate trace metrics, and may change which spans appear as top-level in Datadog.
#
# compute_top_level_by_span_kind: false

## @param peer_service_aggregation - enables `peer.service` aggregation on trace stats in Datadog exporter - optional
## If set to true, enables `peer.service` aggregation in the exporter. If disabled, aggregated trace stats will not include `peer.service` as a dimension.
## For the best experience with `peer.service`, it is recommended to also enable `compute_stats_by_span_kind`.
## If enabling both causes the datadog exporter to consume too many resources, try disabling `compute_stats_by_span_kind` first.
## If the overhead remains high, it will be due to a high cardinality of `peer.service` values from the traces. You may need to check your instrumentation.
## Deprecated: Please use peer_tags_aggregation instead
#
# peer_service_aggregation: true

## @param peer_tags_aggregation - enables aggregation of peer related tags in Datadog exporter - optional
## If set to true, enables aggregation of peer related tags (e.g., `peer.service`, `db.instance`, etc.) in Datadog exporter.
Expand Down