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

Use CurrentTraceContext for OTel's Tracer bridge #310

Merged
merged 3 commits into from
Jul 12, 2023

Conversation

marcingrzejszczak
Copy link
Contributor

without this commit we're not using the whole mechanism of merging scopes, baggages and checking for noops that is inbuilt in CurrentTraceContext when calling tracer.withSpan in OTel with this commit we're redirecting the calls to CurrentTraceContext

fixes gh-215

without this commit we're not using the whole mechanism of merging scopes, baggages and checking for noops that is inbuilt in CurrentTraceContext when calling tracer.withSpan in OTel
with this commit we're redirecting the calls to CurrentTraceContext

fixes gh-215
@marcingrzejszczak marcingrzejszczak changed the base branch from main to 1.0.x July 11, 2023 13:16
@sonatype-lift
Copy link

sonatype-lift bot commented Jul 11, 2023

🛠 Lift Auto-fix

Some of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1

# Download the patch
curl https://lift.sonatype.com/api/patch/github.com/micrometer-metrics/tracing/310.diff -o lift-autofixes.diff

# Apply the patch with git
git apply lift-autofixes.diff

# Review the changes
git diff

Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command:

curl https://lift.sonatype.com/api/patch/github.com/micrometer-metrics/tracing/310.diff | git apply

Once you're satisfied, commit and push your changes in your project.

Footnotes

  1. You can preview the patch by opening the patch URL in the browser.

Comment on lines 132 to 134
final OtelTraceContext otelTraceContext;

final Context old;
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about renaming them to currentOtelTraceContext and oldContext?

@@ -57,6 +57,9 @@ static io.opentelemetry.api.trace.Span toOtel(Span span) {
}

static Span fromOtel(io.opentelemetry.api.trace.Span span) {
if (span instanceof OtelSpan) {
return (OtelSpan) span;
Copy link
Member

Choose a reason for hiding this comment

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

Does this cast have any effect when the return type is Span anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope

@jonatan-ivanov jonatan-ivanov added the bug A general bug label Jul 11, 2023
@jonatan-ivanov jonatan-ivanov added this to the 1.0.9 milestone Jul 11, 2023
@marcingrzejszczak marcingrzejszczak merged commit 241f6bd into 1.0.x Jul 12, 2023
7 checks passed
@jonatan-ivanov jonatan-ivanov deleted the useCurrentTraceContextForTracer branch July 12, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

withSpan does not work as expected using OTel
2 participants