Instrument your Node.js application in Kubernetes¶
Follow the instructions on this page to instrument your Node.js application running in Kubernetes. Make sure you have already installed the Observe Agent.
Add the OpenTelemetry zero-code instrumentation for Node.js.
Run the following commands to add zero-code instrumentation for your Node.js application, meaning you don’t have to modify your application’s source code to collect telemetry:
npm install --save @opentelemetry/api
npm install --save @opentelemetry/auto-instrumentations-node
Configure the Node.js instrumentation. Set the following environment variables. Replace
${YOUR_SERVICE_NAME}
with the name of your app or service.
export OTEL_SERVICE_NAME=${YOUR_SERVICE_NAME}
export NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://observe-agent-forwarder.observe.svc.cluster.local:4318
Run your instrumented app:
node app.js