Manual Instrumentation for Node.js (Docker image)

Step 1: Download the tracing.js file to the root directory.

Step 2: Add the following dependencies to the Dockerfile.

# Install dependencies
RUN npm install --save @opentelemetry/api
RUN npm install --save @opentelemetry/instrumentation
RUN npm install --save @opentelemetry/tracing
RUN npm install --save @opentelemetry/exporter-trace-otlp-http
RUN npm install --save @opentelemetry/resources
RUN npm install --save @opentelemetry/semantic-conventions
RUN npm install --save @opentelemetry/auto-instrumentations-node
RUN npm install --save @opentelemetry/sdk-node
RUN npm install --save @opentelemetry/exporter-jaeger

Step 3: Add the following environment variable line in Dockerfile.

ENV SERVER_NAME=<Server_name>
ENV APPLICARE_ENDPOINT=http://<Applicare_IP>:14268/api/traces

Change the value in that variable as below.

<Server_name>= The name of the agent shown in the Applicare console.

<Applicare_IP>= The IP address of the machine running the Applicare controller.

Step 4: Comment the CMD line already in the Dockerfile. Add below CMD line.

CMD ["node", "--require", "./tracing.js", "app.js (or) server.js (or) node.js"]

Was this article helpful?

Votes, comments and follows are kept by Zendesk, so they need a Help Center account. These buttons open this article there.

Opens Zendesk · needs internet and sign-in

Still stuck? Contact support