From 21367f126140a08e6a49760ad60d981fcd869133 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Thu, 8 Jun 2023 14:50:52 -0400 Subject: [PATCH 1/5] [exporter/datadog] Add trace configs compute_stats_by_span_kind and peer_service_aggregation --- exporter/datadogexporter/config.go | 11 +++++++++++ exporter/datadogexporter/traces_exporter.go | 2 ++ 2 files changed, 13 insertions(+) diff --git a/exporter/datadogexporter/config.go b/exporter/datadogexporter/config.go index 0c78c82fd47f..535136013b38 100644 --- a/exporter/datadogexporter/config.go +++ b/exporter/datadogexporter/config.go @@ -234,6 +234,17 @@ type TracesConfig struct { // The default value is `false`. SpanNameAsResourceName bool `mapstructure:"span_name_as_resource_name"` + // If set to true, enables an additional stats computation check on spans to see they have an eligible `span.kind` (server, consumer, client, producer). + // If enabled, a span with an eligible `span.kind` will have stats computed. If disabled, only top-level and measured spans will have stats computed. + // NOTE: For stats computed from OTel traces, only top-level spans are considered when this option is off. + ComputeStatsBySpanKind bool `mapstructure:"compute_stats_by_span_kind"` + + // If set to true, enables `peer.service` aggregation in the agent. 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. + PeerServiceAggregation bool `mapstructure:"peer_service_aggregation"` + // flushInterval defines the interval in seconds at which the writer flushes traces // to the intake; used in tests. flushInterval float64 diff --git a/exporter/datadogexporter/traces_exporter.go b/exporter/datadogexporter/traces_exporter.go index bfa3b02f9abf..6986c9cf4354 100644 --- a/exporter/datadogexporter/traces_exporter.go +++ b/exporter/datadogexporter/traces_exporter.go @@ -170,6 +170,8 @@ func newTraceAgent(ctx context.Context, params exporter.CreateSettings, cfg *Con acfg.ReceiverPort = 0 // disable HTTP receiver acfg.AgentVersion = fmt.Sprintf("datadogexporter-%s-%s", params.BuildInfo.Command, params.BuildInfo.Version) acfg.SkipSSLValidation = cfg.LimitedHTTPClientSettings.TLSSetting.InsecureSkipVerify + acfg.ComputeStatsBySpanKind = cfg.Traces.ComputeStatsBySpanKind + acfg.PeerServiceAggregation = cfg.Traces.PeerServiceAggregation if v := cfg.Traces.flushInterval; v > 0 { acfg.TraceWriter.FlushPeriodSeconds = v } From fa2bb90d4dc3f4174ce85b5e802d550c779f2a55 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Thu, 8 Jun 2023 15:43:59 -0400 Subject: [PATCH 2/5] Add to changelog --- .../datadogexporter-new-trace-configs.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .chloggen/datadogexporter-new-trace-configs.yaml diff --git a/.chloggen/datadogexporter-new-trace-configs.yaml b/.chloggen/datadogexporter-new-trace-configs.yaml new file mode 100644 index 000000000000..20a304010004 --- /dev/null +++ b/.chloggen/datadogexporter-new-trace-configs.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# 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: Add trace configs compute_stats_by_span_kind and 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: [23240] + +# (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: From 673034d964a021adaf4e71680a783a1e4d2d30b3 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Fri, 9 Jun 2023 10:00:04 -0400 Subject: [PATCH 3/5] Update exporter/datadogexporter/config.go Co-authored-by: Pablo Baeyens --- exporter/datadogexporter/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter/datadogexporter/config.go b/exporter/datadogexporter/config.go index 535136013b38..1b29a9fb7963 100644 --- a/exporter/datadogexporter/config.go +++ b/exporter/datadogexporter/config.go @@ -239,7 +239,7 @@ type TracesConfig struct { // NOTE: For stats computed from OTel traces, only top-level spans are considered when this option is off. ComputeStatsBySpanKind bool `mapstructure:"compute_stats_by_span_kind"` - // If set to true, enables `peer.service` aggregation in the agent. If disabled, aggregated trace stats will not include `peer.service` as a dimension. + // 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. From 76fba667511474e3973123a8f68dc0e09e64a54a Mon Sep 17 00:00:00 2001 From: Yang Song Date: Fri, 9 Jun 2023 10:02:15 -0400 Subject: [PATCH 4/5] Update .chloggen/datadogexporter-new-trace-configs.yaml Co-authored-by: Pablo Baeyens --- .chloggen/datadogexporter-new-trace-configs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/datadogexporter-new-trace-configs.yaml b/.chloggen/datadogexporter-new-trace-configs.yaml index 20a304010004..95587dd0ddfc 100644 --- a/.chloggen/datadogexporter-new-trace-configs.yaml +++ b/.chloggen/datadogexporter-new-trace-configs.yaml @@ -9,7 +9,7 @@ change_type: enhancement component: datadogexporter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add trace configs compute_stats_by_span_kind and peer_service_aggregation +note: "Add `traces::compute_stats_by_span_kind` and `traces::peer_service_aggregation` configuration flags" # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [23240] From 077b26e8554d642587a1309898c297a1bafb47ca Mon Sep 17 00:00:00 2001 From: Yang Song Date: Fri, 9 Jun 2023 11:06:05 -0400 Subject: [PATCH 5/5] Add subtext to changelog --- .chloggen/datadogexporter-new-trace-configs.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.chloggen/datadogexporter-new-trace-configs.yaml b/.chloggen/datadogexporter-new-trace-configs.yaml index 95587dd0ddfc..cb03f78fc7c4 100644 --- a/.chloggen/datadogexporter-new-trace-configs.yaml +++ b/.chloggen/datadogexporter-new-trace-configs.yaml @@ -17,4 +17,5 @@ issues: [23240] # (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: +subtext: Config `traces::compute_stats_by_span_kind` enables an additional stats computation check on span kind. | + Config `traces::peer_service_aggregation` enables `peer.service` aggregation in the exporter.