chore(telemetry): remove unused metrics from telemetry check and push users towards OpenMetrics-based telemetry over expvars #55721
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #55721"
general
weight: 0.35
eliottness
What does this PR do?
This PR revamps the
telemetrycore check, removing metrics that aren't required to be sent directly to the customer's account, and updates our guidance around how to collect the Agent's internal telemetry to prefer the OpenMetrics telemetry endpoint over the expvar endpoint.Motivation
Our approach for how we expose internal telemetry from the Datadog Agent is fractured due to a long list of incremental changes over time, and this PR aims to improve that by starting to clean things up and aligning the Core Agent with the broader guidance we offer customers.
We're doing a few things here:
telemetrychecktelemetrycheck to only emit metrics that are _directly_ required by product features on the Datadog UI through a dedicated allowlisttelemetrycheck to support remapping the name of the metrics defined in its allowlisttelemetrycheck still emits but remapping their name to avoid any breaking changes with customersAll of these things generally fall into one of two buckets: removing complexity with how internal telemetry is defined, and making the metrics we emit (whether by default or when scraped through
/telemetry) more consistent.Removing internal complexity (mostly)
This one is the big one here as it deals with the refactoring and renaming we've done.
Prior to this PR, the whole "default vs non-default" metrics registry thing meant that we collected some metrics that literally never made it into the
/telemetryoutput, which is kind of dumb from a user perspective: it's just internal telemetry, but due to this weird thing we did to emit it by default, they can't _intentionally_ scrape it and send it somewhere else.That pattern also had implications with telemetry coming in over RAR, which landed in the non-default registry, and then required jumping through hoops to extract and merge into the default registry metrics ... it was just a mess. We now put everything into a single registry which means that the
telemetrycheck, COAT, and/telemetryendpoint all have a consistent view of the world.One caveat here is that we had to rename the internal metrics that we emit by default to avoid double counting. Going back to the above, default and non-default metrics couldn't mix before, which meant while that, for example, while
point.sentmight be sent by default, you couldn't also define an OpenMetrics check to scrape/telemetryand collect it _again_ and end up with double counting at query time:point.sentjust wasn't exposed on/telemetry. Collapsing the registries means it _is_ exposed via/telemetrynow, along with any other metric that was specifically a "default" metric.In order to get around this -- continue sending these metrics to customers by default to avoid breakage, but also avoid the double counting risk -- we added support to remap the name of metrics sent by the
telemetrycheck, and changed the base name of these metrics while remapping them back to their old names. This is safe because it avoids customer breakage (due) and because they only show up in/telemetryas of this PR, so we're not changing the name of the metric in/telemetry: it's brand new from the perspective of users.Pushing users towards the OpenMetrics endpoint instead of expvars
This aspect is part of a broader alignment around getting away from expvars.
Expvars are effectively soft deprecated: we expose them, but we hardly ever add new ones anymore. In contrast, our OpenMetrics-based telemetry is richer (tags, types, _more_ metrics in general) and is the blessed approach for Agent development, also serving as the source for COAT data.
As we add more subagents which are not Go-based, we also lack the ability to consistently expose expvar endpoints, while OpenMetrics is more or less the unofficial industry standard for exposing internal telemetry from daemons.
In order to push this forward, we've added a new
openmetrics.d/agent_stats.yaml.exampleexample configuration that aligns with the default set of internal metrics collected by the expvar-based configuration and left thego_expvar.d/agent_stats.yaml.exampleexample configuration in place _but_ marked it as deprecated via a comment block at the top of the file.Likewise, as part of this clean up, we removed an old expvar in the aggregator,
HostnameUpdate, and the associated channels, as the functionality was removed from the aggregator many years ago, and also added a number of new internal telemetry metrics (mostly in the aggregator and logs agent) to match parity with expvar-based versions referenced inagent_stats.yaml.example.Describe how you validated your changes
New unit tests, existing unit tests, E2E tests, all the tests.
Additional Notes