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

Fix OTel extract when there is no current context #8578

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

tjquinno
Copy link
Member

Description

Resolves #8573

The Helidon OpenTelemetryTracer class extract method (which creates a SpanContext from headers) incorrectly returned a no-op SpanContext if there was no current span, rather than the documented Optional.empty().

This PR fixes that by trying to construct an OTel Span first from the context, and only if that yields a span go ahead and return the span context.

The PR also adds a test for this and fixes an earlier test that did not supply enough headers for OTel to fully constitute a valid span.

Documentation

Bug fix; no doc impact

@tjquinno tjquinno self-assigned this Mar 28, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 28, 2024
@tjquinno tjquinno requested a review from spericas March 28, 2024 12:23
@Test
void testExtractWithNoCurrentSpan() {
final String BAGGAGE_KEY = "mykey";
final String BAGGAGE_VALUE = "myvalue";
Copy link
Member

Choose a reason for hiding this comment

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

Not used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@tjquinno tjquinno requested a review from ljnelson March 29, 2024 04:08
@tjquinno tjquinno merged commit f94924c into helidon-io:helidon-3.x Mar 29, 2024
12 checks passed
@tjquinno tjquinno deleted the 3.x-otel-extract branch March 29, 2024 16:41
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
2 participants