@elastic/opentelemetry-node
v1.7.0
Published
Elastic Distribution of OpenTelemetry Node.js (EDOT Node.js)
Readme
EDOT Node.js
The Elastic Distribution of OpenTelemetry Node.js (EDOT Node.js) is a lightweight wrapper around the OpenTelemetry SDK for Node.js that makes it easy to get started using OpenTelemetry in your Node.js applications, especially if you are using Elastic Observability as your observability solution.
# Install it
npm install --save @elastic/opentelemetry-node
# Configure it
export OTEL_EXPORTER_OTLP_ENDPOINT="...your-OTLP/collector-endpoint..."
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=..."
export OTEL_SERVICE_NAME="my-app"
# Start it with your application
node --import @elastic/opentelemetry-node my-app.jsSee the EDOT Node.js docs for details. Some direct links:
How does EDOT Node.js differ from the OpenTelemetry JS SDK?
EDOT Node.js is very similar to the @opentelemetry/auto-instrumentations-node package from OpenTelemetry in its usage goal: a single-dependency that provides a simple path to zero-code instrumentation of Node.js applications. In general, Elastic's goal is to contribute all SDK improvements upstream. That said, there are sometimes differences that are specific to Elastic (e.g. talking to an Elastic service for central configuration, Elastic-authored additional instrumentations). Here is a concise list of differences:
- EDOT Node.js supports dynamic central configuration of some settings of the running SDK.
- EDOT Node.js, being a distribution of the OpenTelemetry JS SDK, always adds the
telemetry.distro.*resource attributes to identify itself. - EDOT Node.js enables some metrics by default that are not included by
@opentelemetry/auto-instrumentations-node: a subset of metrics from@opentelemetry/host-metrics. - EDOT Node.js defaults to
OTEL_SEMCONV_STABILITY_OPT_IN=httpsuch that telemetry from the@opentelemetry/instrumentation-httppackage will use stable HTTP semantic conventions by default. Upstream OpenTelemetry JS has a tracking issue for the migration to newer HTTP semantic conventions in its instrumentations. - EDOT Node.js defaults to
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta, which differs from the upstream OpenTelemetry JS default ofcumulative. - EDOT Node.js uses the more recent import-in-the-middle
createAddHookMessageChannelfeature for improved ESM support. We hope to upstream support for this. - Internal diagnostic logging from EDOT Node.js is in a custom JSON-log format, rather than the message-string-only format from OpenTelemetry JS. diag logging in (luggite) JSON format
