Skip to content
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

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

Merged
merged 7 commits into from
Jan 31, 2025

Conversation

mtoffl01
Copy link
Contributor

@mtoffl01 mtoffl01 commented Jan 29, 2025

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
Copy link

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

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
Copy link

pr-commenter bot commented Jan 29, 2025

Benchmarks

Benchmark execution time: 2025-01-31 18:42:34

Comparing candidate commit d0a04eb in PR branch mtoff/extract-edgecase with baseline commit 7dec46c in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 0 unstable metrics.

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

This looks good to me, as far I can tell.

There is a smoke test failing. Is it related?

@mtoffl01 mtoffl01 enabled auto-merge (squash) January 31, 2025 18:14
@mtoffl01 mtoffl01 merged commit 2ee7731 into main Jan 31, 2025
176 checks passed
@mtoffl01 mtoffl01 deleted the mtoff/extract-edgecase branch January 31, 2025 19:50
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