HyperDX uses the OpenTelemetry standard for collecting telemetry data (logs and traces). Traces are auto-generated with automatic instrumentation, so manual instrumentation isn't required to get value out of tracing.

This Guide Integrates:

✅ Logs✅ Metrics✅ Traces

Getting Started

Install HyperDX OpenTelemetry Instrumentation Package

Use the following command to install the HyperDX OpenTelemetry package (opens in a new tab).

npm install @hyperdx/node-opentelemetry 

Add The Logger Transport

To collect logs from your application, you'll need to add a few lines of code to configure your logging module. If you're using another type of logger, reach out or explore one of our platform integrations if applicable (such as Kubernetes or

By default, console.* methods are supported out of the box. No additional configuration is required.

Run the Application with HyperDX OpenTelemetry CLI

HYPERDX_API_KEY='<YOUR_INGESTION_KEY>' OTEL_SERVICE_NAME='<YOUR_APP_NAME>' npx opentelemetry-instrument index.js

The OTEL_SERVICE_NAME environment variable is used to identify your service in the HyperDX app, it can be any name you want.

Advanced Configuration

Debugging Installation with Verbose Logs

If you're having trouble with the SDK, you can enable verbose logging by setting the DEBUG environment variable to hyperdx.

export DEBUG=hyperdx

(Optional) Advanced Instrumentation Configuration

Capture Console Logs

By default, the HyperDX SDK will capture console logs. You can disable it by setting HDX_NODE_CONSOLE_CAPTURE environment variable to 0.


(Optional) Attach User Information or Metadata - BETA

To easily tag all events related to a given attribute or identifier (ex. user id or email), you can call the setTraceAttributes function which will tag every log/span associated with the current trace after the call with the declared attributes. It's recommended to call this function as early as possible within a given request/trace (ex. as early in an Express middleware stack as possible).

This is a convenient way to ensure all logs/spans are automatically tagged with the right identifiers to be searched on later, instead of needing to manually tagging and propagating identifiers yourself.

userId, userEmail, userName, and teamName will populate the sessions UI with the corresponding values, but can be omitted. Any other additional values can be specified and used to search for events.

import { setTraceAttributes } from '@hyperdx/node-opentelemetry';
app.use((req, res, next) => {
  // Get user information from the request...
  // Attach user information to the current trace

Then enable HyperDX beta mode by setting HDX_NODE_BETA_MODE environment variable to 1.


Google Cloud Run

If you're running your application on Google Cloud Run, Cloud Trace automatically injects sampling headers into incoming requests, currently restricting traces to be sampled at 0.1 requests per second for each instance.

The @hyperdx/node-opentelemetry package overwrites the sample rate to 1.0 by default.

To change this behavior, or to configure other OpenTelemetry installations, you can manually configure the environment variables OTEL_TRACES_SAMPLER=parentbased_always_on and OTEL_TRACES_SAMPLER_ARG=1 to achieve the same result.

To learn more, and to force tracing of specific requests, please refer to the Google Cloud Run documentation (opens in a new tab).

Auto-Instrumented Libraries

The following libraries will be automatically instrumented (traced) by the SDK:

Hi, how can I help you?