Skip to content

feat(trace-agent): add resource peer tags from refreshed mappings - #203

Draft
aquamatthias wants to merge 2 commits into
mainfrom
mv/peer-resource-tags
Draft

aquamatthias wants to merge 2 commits into
mainfrom
mv/peer-resource-tags

Conversation

@aquamatthias

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds six peer tag concepts to the mini agent's PEER_TAG_CONCEPTS and refreshes the embedded peer_tags_mappings.json from the published semantic mappings artifact (v20261119075559-921ed898, 74 concepts):

  • peer.aws.arn
  • peer.aws.sqs.queue.url
  • peer.gcp.project_id
  • peer.kafka.cluster.id
  • peer.gcp.pubsub.topic.name
  • peer.gcp.pubsub.subscription.name

With agent-computed stats (the default), the mini agent now aggregates on these source keys and lists them in /info peer_tags. That's 60 keys instead of 43:

  • aws.function.arn, aws.queue.url, aws.sns.topic.arn, aws.sns.topic_arn, aws.sqs.queue.url, aws.state_machine.arn, aws.step_functions.state_machine.arn, aws.stream.arn, aws.table.arn, aws.topic.arn
  • gcloud.project_id, gcp.pubsub.topic.name, gcp.pubsub.subscription.name
  • kafka.cluster_id, messaging.kafka.cluster_id, messaging.kafka.cluster.id
  • db.system.name, added by the refresh as the last fallback of peer.db.system

The mappings file is copied verbatim. The crate reads only concepts.*.fallbacks[].name, so the extra concepts and metadata are ignored. The 16 concepts the agent already used are unchanged, except for the db.system.name fallback.

The Kubernetes concepts (peer.k8s.cluster.uid, peer.k8s.namespace) are not added; the Datadog Agent computes those itself.

Motivation

REDUDM-1846, part of REDUDM-1740 ("APM: keep the identity of called resources in trace stats"). Without these keys, stats computed by the mini agent can't tell apart calls to different SNS topics, SQS queues, Pub/Sub topics and subscriptions, Kafka clusters or GCP projects. The Datadog Agent gets the same concepts in DataDog/datadog-agent#60159.

Additional Notes

Tracers that read /info will send up to 17 more peer tag keys. ARNs and queue URLs identify single resources, so stats cardinality grows by roughly the number of distinct resources each service calls.

Describe how to test/QA your changes

  • test_peer_tag_keys_exact_set is updated to the 60 expected keys.
  • The existing test that every concept is present in the JSON now covers the six new concepts.
  • New integration test test_pubsub_topic_and_subscription_peer_tags_in_flushed_stats sends a Pub/Sub producer span and consumer span through the mini agent with mock intake. It checks that the topic and the subscription land in separate stats groups, that neither group carries the other's tag, and that both carry gcloud.project_id.
  • cargo test -p datadog-trace-agent: 94 unit and 13 integration tests pass.
  • cargo clippy -p datadog-trace-agent --all-targets -- -D warnings and cargo fmt --all -- --check are clean.

🤖 Generated with Claude Code

Refresh the embedded peer_tags_mappings.json with the published semantic
mappings artifact (74 concepts) and add six concepts to PEER_TAG_CONCEPTS:
peer.aws.arn, peer.aws.sqs.queue.url, peer.gcp.project_id,
peer.kafka.cluster.id, peer.gcp.pubsub.topic.name and
peer.gcp.pubsub.subscription.name.

The mini agent now aggregates stats on, and advertises in /info, the
ARN, SQS queue URL, GCP project, Kafka cluster ID and Pub/Sub topic and
subscription peer tag keys. The refresh also adds db.system.name as a
fallback of peer.db.system.

Add an integration test that checks Pub/Sub topic and subscription stay
separate peer tags in agent-computed stats.

Jira: REDUDM-1846
@aquamatthias

Copy link
Copy Markdown
Collaborator Author

cc @lucaspimentel: this is the serverless-components port of DataDog/datadog-agent#60159 you asked about. The Lambda extension port follows once I have write access there.

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