Skip to content

feat: use DD_SERVICE for inferred spans when integration service names are removed - #814

Draft
zarirhamza wants to merge 1 commit into
mainfrom
zarir/dd-service-inferred-spans
Draft

feat: use DD_SERVICE for inferred spans when integration service names are removed#814
zarirhamza wants to merge 1 commit into
mainfrom
zarir/dd-service-inferred-spans

Conversation

@zarirhamza

@zarirhamza zarirhamza commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true and DD_SERVICE is set, inferred (synthetic) event-source spans use the base service name (DD_SERVICE) instead of the AWS resource/instance representation.
  • An explicit DD_SERVICE_MAPPING entry still takes precedence over DD_SERVICE.
  • Default behavior (flag off) is unchanged, so existing integration snapshots are unaffected.

Resolution order in determineServiceName

  1. DD_SERVICE_MAPPING (specific key, then generic key)
  2. If DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED and DD_SERVICE set → DD_SERVICE
  3. If DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED is off → fallback
  4. Extracted resource/instance name, else fallback

Motivation

Customers currently need one DD_SERVICE_MAPPING entry per trigger type per function to get their event-source spans onto their own service name. This gives them a single setting that consolidates all of them at once.

Tracked by FRSLES-869. Mirrors the resolution order in the Python layer (datadog-lambda-python#834) and in the extension.

Scope

Service-name resolution only. peer.service on inferred spans continues to report DD_SERVICE as it does today; revisiting that pairing is deliberately left to a follow-up.

Test plan

  • 11 new cases in span-inferrer.spec.ts covering all 8 trigger types, DD_SERVICE_MAPPING precedence, unset DD_SERVICE, and precedence over DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED=false
  • npx jest src/trace/span-inferrer.spec.ts — 105 passed
  • Full unit suite — no new failures (2 pre-existing index.spec.ts failures also present on main)
  • Integration snapshots untouched (default behavior unchanged)

…s are removed

When DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true and DD_SERVICE is
set, inferred (synthetic) event-source spans use the base service name instead
of the AWS resource/instance representation. This gives users a single setting
to consolidate every trigger span onto the function's service, rather than one
DD_SERVICE_MAPPING entry per trigger type per function.

An explicit DD_SERVICE_MAPPING entry still takes precedence, and default
behavior is unchanged, so existing integration snapshots are unaffected.

Mirrors the resolution order in datadog-lambda-python.
@datadog-official

datadog-official Bot commented Aug 26, 2026

Copy link
Copy Markdown

Pipelines

Unblock PR with BitsAI

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/datadog-lambda-js | e2e-test-status — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5a44df5 | Docs | View more details | Give us feedback!

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