Comments (4)
This package has a hard dependency on the nodejs_compat compatibility flag. Without it, it would not be feasible to create auto instrumentation. There are no current plans to try to remove the nodejs_compat requirement.
from otel-cf-workers.
Out of curiosity, why is this a hard dependency? I can also look at code but I only see mention of the requirement, not the reason why, in the documentation. I'd love to use this library but it's important to me that my workers are as lightweight as possible. No worries if that's not an eventual goal of this lib, but want to make sure it's not roadmap material before exploring other options.
from otel-cf-workers.
Hey @jesseditson,
You're probably getting confused between node_compat
build option and nodejs_compat
compatibility flag. See the screenshot above, these two are mutually exclusive ways to make nodejs code work on Workers.
The former adds polyfills/shims at build time so imports from fs
and path
won't fail, while the latter enables some extra modules in the runtime, no code added to your worker. The hard dependency is on async local storage, which the library uses for context propagation. The native js solution to that is currently in stage 1, so it'll be a while before we can remove the dependency. The rest (event emitter, buffer) are used in the opentelemetry libraries, so to avoid increasing your worker bundle size, we rely on the runtime's native modules for those as well.
In short: your worker is as lightweight as it can be with nodejs_compat
compatibility flag.
See docs here (and feel free to ask on the Cloudflare Discord if you're curious to know more): https://developers.cloudflare.com/workers/runtime-apis/nodejs/#nodejs-compatibility
and https://developers.cloudflare.com/workers/wrangler/configuration/#add-polyfills-using-wrangler
from otel-cf-workers.
That is extremely helpful! I wasn't clear on the difference between those flags and this makes sense. Thank you!
from otel-cf-workers.
Related Issues (20)
- [Question] Does this also intercept logs and send it? HOT 1
- cache.hit attribute is the opposite
- feature request: export const unwrappedFetch = unwrap(fetch)
- [Question] Support for sending traces to other tracing backends/vendors? HOT 4
- [feature request]: Support for Cloudflare Pages HOT 7
- getTracer + startActiveSpan not working due to missing global patch HOT 2
- Errors importing module HOT 1
- Accurate timings when instrumenting code that doesn't do network IO HOT 5
- [Bug] `trace.getActiveSpan()` returns undefined, regression HOT 7
- Instrumentation breaks new RPC style service calls HOT 12
- RFC: Removing CommonJS support
- Question: Ignore certain hosts or api calls with a header HOT 1
- [feature request]: Support for JSRPC services
- Help with `trace.getActiveSpan()` and `startActiveSpan()` HOT 2
- Bug: Calling a Service Binding RPC method throws a DOMException
- Mention confusing state of console exporter in CloudFlare with wrangler
- Broken with tsx HOT 4
- Allow custom resource attributes HOT 5
- Expose function to return trace header
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otel-cf-workers.