SDKs
OpenTelemetry (Node.js)
Send errors to ErrorDX using the OpenTelemetry SDK for Node.js.
ErrorDX accepts errors via the OpenTelemetry Protocol (OTLP). Any span that records an exception event is ingested and turned into a tracked issue — no Sentry SDK required.
Install
npm install @opentelemetry/sdk-node \
@opentelemetry/exporter-trace-otlp-http \
@opentelemetry/auto-instrumentations-nodeInitialize
Create an instrumentation.ts file and load it before anything else (e.g. via --require ./instrumentation.js):
import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter({
url: "https://<your-host>/v1/traces",
headers: {
// Your project public key — found in Project → Keys
Authorization: "Bearer <PUBLIC_KEY>",
},
}),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
// Capture unhandled exceptions
process.on("uncaughtException", (err) => {
const { trace } = require("@opentelemetry/api");
const span = trace.getTracer("error").startSpan("uncaughtException");
span.recordException(err);
span.end();
sdk.shutdown().finally(() => process.exit(1));
});Manually record exceptions
For caught errors you want to track:
import { trace } from "@opentelemetry/api";
try {
riskyOperation();
} catch (err) {
const span = trace.getActiveSpan();
if (span) {
span.recordException(err as Error);
}
}Authentication
The endpoint uses a Bearer token equal to your project's public key:
| Header | Value |
|---|---|
Authorization | Bearer <publicKey> |
x-opentrace-key | <publicKey> (alternative) |
You can also pass it as a query parameter: ?api_key=<publicKey>.
Protocol notes
- URL:
POST /v1/traces - Encoding: JSON only (
application/json). Protobuf is not yet supported — setOTEL_EXPORTER_OTLP_PROTOCOL=http/jsonor pass{ protocol: "http/json" }to the exporter. - Only span events named
exceptionare stored. All other spans are accepted (returning200) but ignored.