Skip to content

Commit

Permalink
[exporter/datadog] Add trace configs compute_stats_by_span_kind and p…
Browse files Browse the repository at this point in the history
…eer_service_aggregation (open-telemetry#23240)

* [exporter/datadog] Add trace configs compute_stats_by_span_kind and peer_service_aggregation

* Add to changelog

* Update exporter/datadogexporter/config.go

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>

* Update .chloggen/datadogexporter-new-trace-configs.yaml

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>

* Add subtext to changelog

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
  • Loading branch information
songy23 and mx-psi authored Jun 12, 2023
1 parent b247914 commit 6947357
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .chloggen/datadogexporter-new-trace-configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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 `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]

# (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: 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.
11 changes: 11 additions & 0 deletions exporter/datadogexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
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
Expand Down
2 changes: 2 additions & 0 deletions exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,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
}
Expand Down

0 comments on commit 6947357

Please sign in to comment.