Skip to content

Replace the string-tagged metric functions with handles - #407

Draft
cataphract wants to merge 1 commit into
glopes/telemetry-send-metric-handlesfrom
glopes/telemetry-metric-handles
Draft

cataphract wants to merge 1 commit into
glopes/telemetry-send-metric-handlesfrom
glopes/telemetry-metric-handles

Conversation

@cataphract

@cataphract cataphract commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Removes the string-tagged metric functions (counter::increment, decrement and set, rate::set, distribution::add) and moves their callers to the metric handles of #404. The distributions payload goes away: all distributions are now sent as sketches.

Stacked on #406.

Motivation

With handles in place, keeping the old functions would mean two metric APIs, two storage paths in Telemetry, and two distribution payloads. The old path is also the slow one: #404 explains what it costs on every point.

Additional Notes

  • Breaking change. Callers outside dd-trace-cpp must move to handles. Two known ones are the RUM counters of nginx-datadog and httpd-datadog.
  • The tracer's metrics are now a process-wide TracerMetrics struct of handles, created on first use. Every tracer of a process shares them, as it shared the old global metrics. It is never destroyed, so its handles still exist when Telemetry sends app-closing.
  • Telemetry's own metrics (logs_created and the telemetry_api.* metrics) are handles that Telemetry creates, with endpoint:agent as a fixed tag.
  • The tags sent are the same as before. Variable tags are now enums: status_code (1xx to 5xx, via StatusTags::from_http_status), level, new_continued, header_style and truncation_reason.
  • Four metrics that were declared but never recorded are dropped: trace_chunks_enqueued_for_serialization, context_header_truncated, trace_api.ms and telemetry_api.ms.
  • The tests of the old functions now use handles. All 156 test cases pass.

References

Jira ticket: APPSEC-70954

Contributor Checklist

  • I am the author of this pull request and I own it.
  • I reviewed every line of this pull request.
  • This pull request follows the Contributing Guidelines.

The tracer and telemetry record their metrics through handles, so the old
API, which copied and hashed tag strings on every call, is removed.
@cataphract
cataphract added this pull request to stack #405 November 14, 2026 01:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant