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

trace: SpanFromContext and SpanContextFromContext make no allocs #5049

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

pellared
Copy link
Member

@pellared pellared commented Mar 11, 2024

Without this SpanFromContext and SpanContextFromContext produce an allocation when the provided context has no span (e.g. nil, context.Background).

Discovered when working on: #4955

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.4%. Comparing base (9184b10) to head (f27ab1c).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5049   +/-   ##
=====================================
  Coverage   83.4%   83.4%           
=====================================
  Files        238     238           
  Lines      15745   15745           
=====================================
  Hits       13145   13145           
  Misses      2312    2312           
  Partials     288     288           
Files Coverage Δ
trace/context.go 100.0% <100.0%> (ø)
trace/noop.go 57.8% <100.0%> (ø)

@pellared pellared changed the title trace: SpanFromContext has no allocs trace: SpanFromContext and SpanContextFromContext make no allocs Mar 11, 2024
@pellared pellared marked this pull request as ready for review March 11, 2024 12:30
Copy link
Member

@XSAM XSAM left a comment

Choose a reason for hiding this comment

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

👍

@pellared pellared merged commit 6ff94ab into open-telemetry:main Mar 12, 2024
25 checks passed
@pellared pellared deleted the zero-alloc-SpanFromContext branch March 12, 2024 07:39
q-cheng pushed a commit to q-cheng/opentelemetry-go that referenced this pull request Mar 12, 2024
@MrAlias MrAlias added this to the v1.25.0 milestone Apr 3, 2024
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.

5 participants