Skip to content

[APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats#1189

Draft
lucaspimentel wants to merge 4 commits intomainfrom
lpimentel/fix-stats-span-kind-peer-tags
Draft

[APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats#1189
lucaspimentel wants to merge 4 commits intomainfrom
lpimentel/fix-stats-span-kind-peer-tags

Conversation

@lucaspimentel
Copy link
Copy Markdown
Member

@lucaspimentel lucaspimentel commented Apr 16, 2026

Overview

Configure SpanConcentrator in bottlecap with the Go agent's default ComputeStatsBySpanKind span kinds and basePeerTags peer tag keys, fixing two gaps in agent-side trace stats computation:

  • APMSVLS-464: span_kinds_stats_computed was empty, so non-top-level, non-measured spans with span.kind = server/client/producer/consumer) were silently excluded from stats.
  • APMSVLS-463: peer_tag_keys was empty, so client/producer/consumer spans had no per-dependency granularity in stats output (e.g., all S3 buckets, DynamoDB tables, Kafka topics lumped together).

Changes

  • Add STATS_ELIGIBLE_SPAN_KINDS constant (4 span kinds matching the Go agent's KindsComputed)
  • Add DEFAULT_PEER_TAG_KEYS constant (43 peer tag keys matching the Go agent's basePeerTags from mappings.json)
  • Pass both to SpanConcentrator::new() instead of empty vecs
  • Add tests that exercise the full StatsConcentratorService pipeline for both features

Follow-up

Move the constants to datadog-agent-config in serverless-components so both bottlecap and serverless-compat can share them.

Testing

  • test_span_kind_stats_computed: sends a non-root, non-measured client span through the service, verifies stats are produced with span_kind="client"
  • test_peer_tags_populated: sends a client span with db.instance and db.system meta, verifies peer_tags contains both in the stats output
  • Tests were written first and confirmed failing before the fix was applied
  • Full test suite still passes

Tests verify that StatsConcentratorService computes stats
for spans with span.kind and populates peer_tags in output.
Both tests currently fail due to empty span_kinds_stats_computed
and peer_tag_keys vecs passed to SpanConcentrator::new().

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
Pass STATS_ELIGIBLE_SPAN_KINDS and DEFAULT_PEER_TAG_KEYS to
SpanConcentrator::new() to match the Go agent defaults. This
enables stats for OTel spans with span.kind and adds per-dependency
granularity via peer tags for client/producer/consumer spans.

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
@lucaspimentel lucaspimentel changed the title [APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats in bottlecap [APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats Apr 16, 2026
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
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