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

Allow building ServerMiddleware without a TracerProvider #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arturaz
Copy link

@arturaz arturaz commented Jan 28, 2025

You don't always want to use a TraceProvider, sometimes you just want to extend another trace.

For example, I start my trace a bit earlier, to capture client span, and therefore, I use my own TraceProvider.

image

This breaks binary compatibility, but I figured that is OK, given that 0.11 changed the API anyway.

My usecase for the curious:

arturaz added a commit to arturaz/packages that referenced this pull request Jan 28, 2025
@NthPortal
Copy link
Contributor

NthPortal commented Jan 29, 2025

@arturaz you can use separate Tracers within a single trace as long as they both came from the same Otel4s instance. if you want to create a new span within a span created by a different Tracer from the same Otel4s, it will Just Work™. additionally, if you want to modify a span created by a different Tracer from the same Otel4s, the Tracer#currentSpan{Context,OrNoop,OrThrow} family of methods will all access the current span exactly as desired.

you don't actually even need to use the same Otel4s as long as you propagate the trace and span information, as is done over requests between different services.

This breaks binary compatibility, but I figured that is OK, given that 0.11 changed the API anyway.

0.11 isn't even out yet; if I'm convinced this is a good idea, RC 1 will just not be binary compatible with the release. I think my comment addresses your concerns, but please let me know if I'm wrong


what's important is actually just that they use the same LocalContext, which coming from the same Otel4s guarantees
or LocalContext
"did you really need footnotes?" not really, i just think daggers are fun

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.

2 participants