Dash0 seamlessly integrates with your server-side JavaScript and CLIs, providing clear visibility into your system's activity and performance.
The Dash0 Kubernetes Operator automatically instruments your Node.js workloads. We recommend all Kubernetes users use the operator instead of manually configuring the OpenTelemetry SDKs.
Instrumenting your Node.js application to generate traces, logs, and metrics is a powerful way to gain deep insights into its behavior and performance. By adding instrumentation, you enable your application to emit valuable data that can be used for monitoring, troubleshooting, and optimization.
Dash0 supports automatic instrumentation of Node.js applications through OpenTelemetry's open-source and vendor-agnostic packages.
The OpenTelemetry Node.js SDK comes with a ready-made auto-instrumentation package that gets you up and running in no time:
However, installing the @opentelemetry/auto-instrumentations-node
package and its dependencies (including the OpenTelemetry JS SDK) is not sufficient by itself. You also need to activate the SDK, as described in the next section.
To send data to Dash0, you need to configure the following settings:
1. Activate the OpenTelemetry JS SDK
Use the NODE_OPTIONS
environment variable to load OpenTelemetry dependencies during the Node.js runtime startup:
This ensures that the OpenTelemetry SDK is loaded as the very first step. This method avoids modifications to startup scripts or similar configurations.
Note: Tools like npm
, pnpm
, and yarn
are also Node.js applications. If you notice OpenTelemetry data about package installations, this is why.
2. Specify the application service name:
Replace my-first-observable-service
with a name that identifies your application.
3. Set up the data export endpoint and authorization token:
Note: You can specify which dataset to send data to by adding the Dash0-Dataset
header. For example:
For more information, see the dataset documentation.
4. Configure the metrics exporter:
The log and trace exporter defaults to otlp
.
Most auto-instrumentation configurations can be configured through environment variables. Refer to the OpenTelemetry SDK documentation for more details.
In case you are not using the Dash0 operator for Kubernetes to deploy your application, you should extend the OpenTelemetry resource attributes to include the Pod UID. This is important to merge the resources between logs,traces and metrics. You can do this by adding the following environment variables to your deployment:
This will add the k8s.pod.name
and k8s.pod.uid
attributes to the OpenTelemetry resource attributes, which will be included in all telemetry data sent to Dash0.
To read more about resource equality and merging, please refer to the Dash0 docs.
In order to learn more about the importance of resource attributes read the blog post OpenTelemetry resource attributes: Best practices for Kubernetes
To understand which libraries are automatically instrumented by this package, please refer to the OpenTelemetry documentation.