Skip to content

fix(apm): Enhance Synthetic Span Service Representation #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 7, 2025
Merged

Conversation

zarirhamza
Copy link
Contributor

@zarirhamza zarirhamza commented Jul 18, 2025

What does this PR do?

Rollout of span naming changes to align serverless product with tracer to create streamlined Service Representation for Serverless

Key Changes:

  • Change service name to match instance name for all managed services (aws.lambda -> lambda name, etc) (breaking)

  • Opt out via DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED

  • Add span.kind:server on synthetic spans made via span-inferrer, cold start and lambda invocation spans

  • Remove _dd.base_service tags on synthetic spans to avoid unintentional service override

Motivation

Improve Service Map for Serverless. This allows for synthetic spans to have their own service on the map which connects with the inferred spans from the tracer side.

Copy link

@joeyzhao2018 joeyzhao2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zarirhamza zarirhamza marked this pull request as ready for review August 6, 2025 01:58
@zarirhamza zarirhamza requested a review from a team as a code owner August 6, 2025 01:58
@duncanista duncanista requested a review from Copilot August 6, 2025 16:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances synthetic span service representation to improve Serverless Service Map functionality by aligning with tracer behavior. It implements a configurable service naming strategy that defaults to using instance-specific names instead of generic AWS service names, while maintaining backwards compatibility through an environment variable.

Key Changes:

  • Modify service naming to use instance names (e.g., lambda function name, S3 bucket name) as service names instead of generic AWS service names
  • Add environment variable DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED to control this behavior (opt-out when set to "false")
  • Add span.kind:server tag to synthetic spans and remove _dd.base_service tags to prevent unintentional service overrides

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
bottlecap/src/lifecycle/invocation/triggers/mod.rs Add service name resolution logic with environment variable support and instance name fallback
bottlecap/src/lifecycle/invocation/processor.rs Update main processor to use new service naming strategy and add span.kind tag
bottlecap/src/lifecycle/invocation/span_inferrer.rs Add span.kind:server tag to inferred spans
bottlecap/src/traces/trace_processor.rs Remove _dd.base_service tag from spans to prevent service override
bottlecap/tests/service_naming_test.rs Add comprehensive tests for new service naming behavior
Various trigger event files Update all trigger implementations to use new service resolution signature
bottlecap/tests/payloads/eventbridge_span.json Update test payload to reflect new service naming

@duncanista duncanista requested a review from astuyve August 6, 2025 16:14
Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM – just left a comment!

@duncanista duncanista changed the title Enhance Synthetic Span Service Representation fix(apm): Enhance Synthetic Span Service Representation Aug 7, 2025
@zarirhamza zarirhamza merged commit f566739 into main Aug 7, 2025
46 checks passed
@zarirhamza zarirhamza deleted the zarir/ssr branch August 7, 2025 19:23
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.

3 participants