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

[3.x] Guard against NPE during early invocation of Span.current() #8256

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

tjquinno
Copy link
Member

@tjquinno tjquinno commented Jan 17, 2024

Description

Resolves #8255

See description of scenario in the issue.

This PR changes TracerProviderHelper#currentSpan to check if TRACER_PROVIDER is null and, if so, returns Optional.empty() for the current span instead of throwing the NPE.

This should not happen unless a custom tracer provider tries, directly or indirectly, to use Span.current() during its initialization.

Documentation

Bug fix; no doc impact.

@tjquinno tjquinno self-assigned this Jan 17, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 17, 2024
@tjquinno tjquinno requested a review from tomas-langer January 17, 2024 21:58
@tjquinno tjquinno changed the title Guard against NPE during early invocation of Span.current() [3.x] Guard against NPE during early invocation of Span.current() Jan 18, 2024
@tjquinno tjquinno merged commit 75f8f1b into helidon-io:helidon-3.x Jan 18, 2024
12 checks passed
@tjquinno tjquinno deleted the 3.x-tracer-provider-fix branch January 18, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.x] Backport of #8254 - TracerProviderHelper#currentSpan() throws NPE in some situations
2 participants