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

Push the span context to gracefully handle multiple routers #15

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

seancribbs
Copy link
Contributor

In the previous version, I did not anticipate the possibility that one router
might delegate to another for code-organization reasons, and so we would enter
the telemetry handler code twice while trying to service a request and lose the
parent context we attempted to save on the first time around. We witnessed this
as traces in our aggregator/visualizer that were missing root spans.

This change brings the code closer to what opentelemetry_telemetry does without
adding that dependency; namely, it maintains the parent context as a list/stack
and pushes onto it when a new span is created, popping it when a span completes.
Also, if a context already exists, we don't attempt to extract propagation from
the request headers. This change will also make the library more compatible with
webserver instrumentation like opentelemetry_cowboy, which does the header
extraction and context creation.

In the previous version, I did not anticipate the possibility that one router
might delegate to another for code-organization reasons, and so we would enter
the telemetry handler code twice while trying to service a request and lose the
parent context we attempted to save on the first time around. We witnessed this
as traces in our aggregator/visualizer that were missing root spans.

This change brings the code closer to what opentelemetry_telemetry does without
adding that dependency; namely, it maintains the parent context as a list/stack
and pushes onto it when a new span is created, popping it when a span completes.
Also, if a context already exists, we don't attempt to extract propagation from
the request headers. This change will also make the library more compatible with
webserver instrumentation like opentelemetry_cowboy, which does the header
extraction and context creation.
@pedro-gutierrez
Copy link

@seancribbs @tsloughter trying to bring this back to life.. Any thoughts on what you'd like to see in this PR in order for it to be ready to be merged ?

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.

4 participants