datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

[trace] Ensure dogstatsd is enabled before emitting trace metrics

Open tabacco opened this issue 2 years ago • 2 comments
trafficstars

Fixes https://github.com/DataDog/datadog-agent/issues/8041

What does this PR do?

  • Add a check for whether dogstatsd is enabled before emitting any trace metrics. This ensures that dogstatsd-formatted metrics are not accidentally leaked to another statsd listener in the event that the default DD_DOGSTATSD_PORT value is set but DD_USE_DOGSTATSD is disabled. Fixes #8041

Motivation

  • https://github.com/DataDog/datadog-agent/issues/8041

Additional Notes

Possible Drawbacks / Trade-offs

  • This may be an unexpected behavior change in some corner configuration cases, but I believe that by the phrasing of DD_USE_DOGSTATSD this is the correct behavior if that setting is false.
    • Also: this is consistent with another check within the trace package: https://github.com/DataDog/datadog-agent/blob/main/pkg/trace/api/dogstatsd.go#L22-L27

Describe how to test/QA your changes

  • Added a new unit test to the suite for this case, and the existing ones should continue to pass.

Reviewer's Checklist

  • [ ] If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • [ ] Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • [ ] A release note has been added or the changelog/no-changelog label has been applied.
  • [ ] Changed code has automated tests for its functionality.
  • [ ] Adequate QA/testing plan information is provided if the qa/skip-qa label is not applied.
  • [ ] At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • [ ] If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • [ ] If applicable, the need-change/operator and need-change/helm labels have been applied.
  • [ ] If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • [ ] If applicable, the config template has been updated.

tabacco avatar Aug 30 '23 14:08 tabacco

CLA assistant check
All committers have signed the CLA.

bits-bot avatar Aug 30 '23 14:08 bits-bot

Thanks!

tabacco avatar Aug 30 '23 21:08 tabacco