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

OpenCensus trace shim #3203

Open
1 of 6 tasks
aabmass opened this issue Mar 1, 2023 · 2 comments
Open
1 of 6 tasks

OpenCensus trace shim #3203

aabmass opened this issue Mar 1, 2023 · 2 comments
Assignees
Labels
shim OpenTracing or OpenCensus compatibility

Comments

@aabmass
Copy link
Member

aabmass commented Mar 1, 2023

Implement the OpenCensus trace shim.

Tasks:

@aabmass aabmass added the shim OpenTracing or OpenCensus compatibility label Mar 1, 2023
@aabmass aabmass self-assigned this Mar 1, 2023
@aabmass
Copy link
Member Author

aabmass commented Mar 6, 2023

From #3210

SpanKind and Links cannot be translated with the shim. OpenCensus Tracer.start_span() only accepts span name, while OTel only allows setting those properties in start_span(); there is no way to set them after the fact with a pure API bridge.

This could easily be supported if open-telemetry/opentelemetry-specification#3186 gets merged and implemented.

@aabmass
Copy link
Member Author

aabmass commented Mar 22, 2023

  • Bridge the Context APIs – needed for instrumentations which extract a Context with propagators e.g. opencensus-ext-flask.

I don't think bridging the OC context API To OTel is possible. OC context API has no "detach"
concept; in fact, the ContextVar.set() calls do not even save the returned token
https://github.com/census-instrumentation/opencensus-python/blob/master/context/opencensus-context/opencensus/common/runtime_context/__init__.py#L156.

Instead, the ContextTracer manually resets the previous value by calling set with the parent
span context:
https://github.com/census-instrumentation/opencensus-python/blob/2e08df591b507612b3968be8c2538dedbf8fab37/opencensus/trace/tracers/context_tracer.py#L114-L117

Meanwhile, OTel achieves this (correctly) by just using ContextVar.reset(token).

Instead, I think it will be more compatible to just continue using the OC RuntimeContext as is
and just mirror the parts we are interested in bridging into the OTel context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shim OpenTracing or OpenCensus compatibility
Projects
None yet
Development

No branches or pull requests

1 participant