Skip to content

ddtrace/tracer: Fix panic on Extract when DD_TRACE_PROPAGATION_EXTRACT_FIRST=true and no trace headers present#3128

Merged
mtoffl01 merged 7 commits into
mainfrom
mtoff/extract-edgecase
Jan 31, 2025
Merged

ddtrace/tracer: Fix panic on Extract when DD_TRACE_PROPAGATION_EXTRACT_FIRST=true and no trace headers present#3128
mtoffl01 merged 7 commits into
mainfrom
mtoff/extract-edgecase

Conversation

@mtoffl01

@mtoffl01 mtoffl01 commented Jan 29, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a panic caused by this line of code: return extractedCtx.(*spanContext), nil, when extractedCtx is nil.

Motivation

Bug was detected when configuring DD_TRACE_PROPAGATION_EXTRACT_FIRST=true and no tracing-related keys are found in carrier. To reproduce this, you can paste the TestExtractNoHeaders to the v1.71.0 branch and watch it panic.
Bug was introduced in v1.71.0 as a result of this PR.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jan 29, 2025

Copy link
Copy Markdown

Datadog Report

Branch report: mtoff/extract-edgecase
Commit report: ca210a1
Test service: dd-trace-go

✅ 0 Failed, 5220 Passed, 73 Skipped, 1m 22.33s Total Time

@mtoffl01 mtoffl01 changed the title WIP: Fix panic on 0 trace propagation headers ddtrace/tracer: Fix panic on Extract when DD_TRACE_PROPAGATION_EXTRACT_FIRST=true and no trace headers present Jan 29, 2025
@mtoffl01
mtoffl01 marked this pull request as ready for review January 29, 2025 21:56
@mtoffl01
mtoffl01 requested a review from a team as a code owner January 29, 2025 21:56
@pr-commenter

This comment was marked as outdated.

kakkoyun

This comment was marked as resolved.

@mtoffl01
mtoffl01 enabled auto-merge (squash) January 31, 2025 18:14
@mtoffl01
mtoffl01 merged commit 2ee7731 into main Jan 31, 2025
@mtoffl01
mtoffl01 deleted the mtoff/extract-edgecase branch January 31, 2025 19:50
mtoffl01 added a commit that referenced this pull request Feb 3, 2025
mtoffl01 added a commit that referenced this pull request Feb 3, 2025
hannahkm pushed a commit that referenced this pull request Feb 4, 2025
…XTRACT_FIRST=true and no trace headers present (#3128)
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.

2 participants