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

4.1.3: Add context propagation to the Zipkin tracing provider (#9119) #9385

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

barchetta
Copy link
Member

Backport of #9119 to Helidon 4.1.3

Description

Resolves #8848 for Zipkin.

Changes:

  1. Add a context propagator implementation for Zipkin. This permits Helidon to propagate Zipkin trace information across threads within a Helidon server. (That's distinct from trace propagation via HTTP headers which is handled in other code and already worked prior to this PR.)

  2. Correct the handling of the global tracer in the Helidon OpenTracing provider component.

    Our Zipkin tracing provider component relies to some extent on our OpenTracing provider types. If a user includes the Zipkin tracing provider then OpenTracing comes along and our Zipkin implementation uses OpenTracing.

    Previously, invoking OpenTracingTracerProvider#global() would return a new Helidon Tracer instance every time. Those instances would all wrap the single OpenTracing global tracer (whatever it is), but that's inefficient and caused failures in an existing propagation test in the provider-tests component. That test had been excluded for Zipkin because of the prior lack of propagation support.

    This PR changes two aspects of the global tracer handling in OpenTracing:

    1. Use LazyValue for the Helidon global tracer maintained by our OpenTracing provider so we reuse it appropriately rather than creating a new one on each invocation of global().
    2. Both in the LazyValue factory lambda and in the OpenTracingTracerProvider#global(Tracer) method not only set or update the Helidon global tracer lazy value but also manage OpenTracing's similar mechanism. OpenTracing lets us supply code we want OpenTracing to run to create the OpenTracing global tracer. By specifying our code for this work we make sure our global Helidon tracer and the delegate global tracer in OpenTracing are in step.
  3. Remove the exclusion in the Zipkin provider pom.xml of the common context propagation test. The pom does now invoke it in a separate surefire execution to make sure the test has a functioning global tracer undisturbed by other tests.

  4. (Otherwise untouched for this enhancement) Add public constructor to ZipkinTracerProvider to clear the Javadoc warning.

Documentation

Bug fix. Our tracing documentation does not discuss context propagation across threads within a server, so this PR has no doc impact.

* Add context propagation to the Zipkin tracing provider

Signed-off-by: Tim Quinn <[email protected]>
@barchetta barchetta added backport Issues that are merged into a single branch, but missing in either master or previous release 4.x Version 4.x labels Oct 14, 2024
@barchetta barchetta added this to the 4.1.3 milestone Oct 14, 2024
@barchetta barchetta self-assigned this Oct 14, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 14, 2024
@barchetta barchetta mentioned this pull request Oct 14, 2024
16 tasks
@barchetta barchetta merged commit 3155cfa into helidon-io:helidon-4.1.x Oct 14, 2024
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x backport Issues that are merged into a single branch, but missing in either master or previous release OCA Verified All contributors have signed the Oracle Contributor Agreement. tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants