Skip to content

Commit b5892fd

Browse files
authored
docs: Add documentation for supporting instrumentation w/bundlers (#183)
1 parent 2f908b5 commit b5892fd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/node-opentelemetry/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ If you are having trouble getting events to show up in HyperDX, you can enable v
124124

125125
If you're pointing to a self-hosted collector, ensure the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable is set to the correct endpoint (ex. `http://localhost:4318`) and is reachable (ex. `curl http://localhost:4318/v1/traces` should return a HTTP 405).
126126

127+
#### Bundlers (esbuild, webpack, etc.)
128+
129+
When using bundlers like esbuild with OpenTelemetry, in order to auto-instrument supported libraries, you'll want to make sure you make them available outside of the bundle. For instance:
130+
131+
- For **esbuild**: Use a plugin like [esbuild-node-externals](https://www.npmjs.com/package/esbuild-node-externals) to exclude Node.js modules and libraries from bundling
132+
- For **other bundlers**: Use equivalent plugins or configurations that prevent bundling of Node.js modules and dependencies that OpenTelemetry needs to instrument
133+
134+
This ensures that OpenTelemetry can properly access and patch the original modules at runtime rather than using bundled versions, which would make them unavailable to auto-instrumentation.
135+
127136
### (Optional) Attach User Information or Metadata (BETA)
128137

129138
> WARNING: ONLY WORKS WITH NODE 14.8.0+

0 commit comments

Comments
 (0)