WIP
NodeJS Instrumentation setup
If you'd like to benefit from the standard NodeJS instrumentations such as HTTP and gRPC, install and register them directly. This way you choose your dependencies and how they are configured.
For the full instrumentation suite, install the meta package:
meteor npm i --save @opentelemetry/auto-instrumentations-node @opentelemetry/instrumentation
Now you just need to configure the instrumentations.
For example, this server file disables fs
and also skips HTTP healthchecks:
1import { registerInstrumentations } from '@opentelemetry/instrumentation'; 2import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'; 3 4registerInstrumentations({ 5 instrumentations: [ 6 getNodeAutoInstrumentations({ 7 '@opentelemetry/instrumentation-http': { 8 ignoreIncomingRequestHook(req) { 9 if (req.url == '/healthz' || req.url == '/readyz') return true; 10 if (req.url?.startsWith('/sockjs/')) return true; 11 return false; 12 }, 13 }, 14 '@opentelemetry/instrumentation-fs': { 15 enabled: false, 16 }, 17 }), 18 ], 19});
Example settings.json
Note that only the server's OTel can be configured by environment variables.
The client configuration can only be applied via settings.json
.
1{ 2 "packages": { 3 "danopia:opentelemetry": { 4 "enabled": true, 5 "resourceAttributes": { 6 "service.name": "my-app", 7 "deployment.environment": "local" 8 } 9 } 10 }, 11 "public": { 12 "packages": { 13 "danopia:opentelemetry": { 14 "enabled": true, 15 "resourceAttributes": { 16 "service.name": "my-app-web", 17 "deployment.environment": "local" 18 }, 19 "otlpEndpoint": "https://some-public-otel-collector" 20 } 21 } 22 } 23}