statsd: add container-based config discovery support#24530
Draft
vitkyrka wants to merge 2 commits into
Draft
Conversation
Adds a from_ports discovery strategy targeting the StatsD management interface (port 8126), plus an auto_conf.yaml with the statsd ad_identifier. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 4a71755 | Docs | Datadog PR Page | Give us feedback! |
Contributor
Validation ReportAll 21 validations passed. Show details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds container-based config discovery support to statsd.
Docker-compose change: the fixture builds a custom image from
statsd/statsd:${STATSD_VERSION}with noimage:tag, so Compose named the built image<project>-statsd, which never matched thestatsdad_identifiersvalue; added an explicitimage: statsd/statsd:${STATSD_VERSION}tag so the locally-built image keeps the same name a real deployment would use. Also added a${DD_LOG_1:-/dev/null}fallback (target is a file, so the fallback is/dev/null) sinceassert_all_discovery_candidates_stable'sdocker compose pssubprocess call doesn't inheritdocker_run'senv_vars=.Port selection rationale: Port 8126 is StatsD's official documented default management/admin TCP interface port (
mgmt_portinconfig.js), which is exactly the port the check'sStatsCheck.check()connects to over a raw TCP socket to issuehealth/stats/counters/gauges/timerscommands.Endpoint shape: StatsD talks raw TCP, not HTTP, so
spec.yamluses the manualfrom_portsstrategy with separatehost/portcandidate fields instead of thediscovery/openmetrics_from_portstemplate.Exact-tag-match test helper: the existing
test_e2e's sharedassert_metrics_covered()helper asserts an exacthost:/port:tag pair that the check derives from its own connection parameters. Under discovery the Agent connects directly to the container's own internal host/port (unknown ahead of time), sotest_e2e_discoveryasserts metric/service-check presence without those tags instead of reusingassert_metrics_covered()verbatim.Motivation
https://datadoghq.atlassian.net/browse/DSCVR-610
Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged