-
Notifications
You must be signed in to change notification settings - Fork 810
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
Separate Context Propagation from Tracer API #9
Comments
I see the conversation already started about separation in #6. |
I learned today that the proposed API won't fit more complex uses-cases probably where operations are put in a queue and will run later in a different context. However, I still believe we should have a conversation about how to handle API separation. |
Why the distinction between a root span and a child span? I can't find this in the spec and it doesn't seem necessary. A span is automatically a root span if it has no parent. It also makes it more difficult to use as if you don't know whether there is a parent you need an additional condition instead of just passing
As discussed in #6 I think the context propagation itself is not a tracing concern and the implementation should be in a completely separate project that can be used for any arbitrary data.
This can only be solved by monkey patching or by within the library. There is an incomplete list of the most popular affected modules here. Other modules known to be affected include Knex and most Promise libraries. |
|
It's not really possible to do it in the library natively without using From the user's perspective, I think a simple |
I believe we've implemented that with the different |
Agreed, closed via #103 |
Context
Context Propagation/Continues Local Storage (CLS) is not part of the language, JavaScript or the runtime Node's offering. Although there is some work in Node Core to support distributed tracing use-cases, the solutions today like node-continuation-local-storage come with significant performance overhead and issues, especially with using third-party libraries and a larger amount of async operations like Promises in user-land.
The current practice among APM providers is to hook the Node's module system, monkey patch core modules and bind async primitives via CLS in Node to achieve one line automatic tracing for their customers. This solution is acceptable for most of the Node users, but not for everyone, it's also not compatible with browser environments.
I believe the new OpenTelemetry initiative would give us the opportunity to create a simple synchronous tracer API like OpenTracing and the ability to handle CLS as a separate extension of this API.
Example API
(based on current OpenCensus APIs)
Synchronous Tracer APIs:
CLS interface to set the context (must be async):
Tracer API combined with CLS:
An additional benefit of this API is that using
withSpan
developer could chain spans in CLS and client RPCs like gRPC would start from the correct contextual child span. OpenCensus today doesn't support context propagation for child spans.census-instrumentation/opencensus-node#498
The text was updated successfully, but these errors were encountered: