Prerequisites
- Node.js 18+
- Your Rocketgraph ingress endpoint:
https://ingress.us-east-2.rocketgraph.app
1. Install the auto-instrumentation package
Install the OpenTelemetry API and the Node auto-instrumentations metapackage:http, express, pg, redis, mongodb, and many other libraries. See OpenTelemetry JS auto-instrumentations for the full list.
2. Configure via environment variables
Point the OTLP exporter at your Rocketgraph ingress and set your service name:Replace
rg_live_xxxxxxxxxxxxxxxxxxxxxx with your actual Rocketgraph API key in your settings page. The SDK will append the correct OTLP paths for traces, metrics, and logs.- OTEL_EXPORTER_OTLP_PROTOCOL — Use
http/protobuf(common for HTTP) orgrpc. - OTEL_RESOURCE_ATTRIBUTES — Add attributes such as
deployment.environment=productionork8s.pod.name=my-pod.
3. Run your application
Load the auto-instrumentation module with Node’s--require flag so it runs before your app. Your existing entry file stays the same:
tracing.js that registers the same auto-instrumentations and uses env vars for the endpoint:
Next steps
- Add logging in Node.js as OTEL doesn’t support console.logs natively.
- Add custom metrics in Node.js.
- Configure log enrichment (e.g. deployment and Kubernetes instance ID).
- Set up alerts and SLOs in Rocketgraph.