Reputation: 3423
OpenTelemetry SDK for Node.js requires tracing to be set up before running (or even importing) any other code. An example of such recommendation can be seen in the official documentation.
I tried to ignore that advice and I could see that no traces are being logged. Why is that? I had a look into the SDK code and I do not see any reason why the SDK behaves this way.
What am I missing? I'd like to understand what is the root cause of the requirement.
Upvotes: 1
Views: 371
Reputation: 190952
It is because it intercepts the module resolution and wraps implementations. Node will cache modules and it would be nearly impossible to monkey patch after the fact. You can see this in the instrumentation packages.
Upvotes: 8