We recommend using the open-source
dd-trace-js library to instrument your Node.JS applications.
npm install --save dd-trace
Simply import and initialize the tracer
// This line must come before importing any instrumented module. const tracer = require('dd-trace').init()
You can find the detailed docs on how to instrument here.
You need to make sure that the generated traces will reach ArchSaber's APM agent, which will then process and forward it to ArchSaber. This step depends upon how you have deployed the agent.
You don't need to do anything. The library, by default, sends traces to
localhost:8126, which is also where the agent listens at.
If you have installed the agent as a docker container on the same network (non-default bridge) as your application container(s), you will need to make the agent's container name available to your application. You can do this by initializing the tracer using the container name for the
DD_TRACE_AGENT_HOSTNAME setting as documented here.
In this case, the agent is deployed as a daemonset on every node of your cluster. It listens on the node's network address space at port
8126. You can expose the node's name to your application via an env variable in the Kubernetes yml file of your application deployment as shown below.
env: - name: ARCHSABER_AGENT_HOSTNAME valueFrom: fieldRef: fieldPath: spec.nodeName
ARCHSABER_AGENT_HOSTNAME environment variable can then be used to configure the tracer to send traces to the agent (as shown in the docker scenario above).