-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Node Compat & AsyncContext #26
Comments
Would it mean that the node_compat option would be required in order to use opentelemetry-sdk-workers? Or just the automatic tracing? |
I'm still on the fence about this and would love to hear any feedback. That said, having talked with a member of the Cloudflare team there should be no downside to flipping on that flag as I understand it. |
Indeed, but I feel like this is a choice to be made on the part of the application developer. The
That makes sense. My opinion: dropping the current instrumentation SDK is fine, as long as the SDK is designed so that one can reimplement the API in user space is they don't want |
The hope is that eventually the flag would get dropped when the RFC lands in workers, while providing a much better DevUX where you don't have to constantly manually invoke the SDK to instrument everything. So while I agree that it's certainly weird, the
Unfortunately that may not be easily workable. We're shifting assumptions the SDK makes from "there's a per work context that we have to manually flow ourselves" to "there's an async context that we can make automatically flow for each workers call". I don't see a way to make both worth without reimplementing 50% of the SDK basically. |
That makes sense. Let's say that I don't like it, but it is a sensible choice. The fact that there is a standard on the horizon managed to assuage my concerns. Thanks a lot for laying out your reasoning. |
For sure! This is an unambiguously breaking change and requires an esoteric flag, so I want to make the reasoning is sound. I'll be updating the documentation to outline as such when this work lands. |
Official blog post announcement: https://blog.cloudflare.com/workers-node-js-asynclocalstorage/ |
One of the biggest warts with the Otel sdk today is we can not behave like the Node and Browser versions and automatically patch and flow tracestate through fetch calls. This is partially because there's no garuntees about global state (and it's actively discouraged) and there's no equivalent to
async_hooks
in Cloudflare Workers....
Until now! https://twitter.com/jasnell/status/1633949738516230144?s=20
Cloudflare has added a
node_compat
option that enablesasync_hooks
just like Node and is planning to implement a brand new proposal to standardize Async state storage in an efficient manner.As such, I'm planning to try and release a new version of the SDK based on hooks and monkey-patching fetch like other SDKs do and hopefully removing the need to fetch via the SDK.
The text was updated successfully, but these errors were encountered: