Skip to content

OpenTelemetry

Send traces to Amlexia via the Node SDK exporter or raw OTLP to ingest.

Node.js exporter

typescript
import { AmlexiaClient } from '@amlexiahq/node';
import { exportOtelSpans } from '@amlexiahq/node/otel';

const client = new AmlexiaClient({
  sdkKey: process.env.AMLEXIA_SDK_KEY!,
});

// After your OTEL span processor produces readable spans:
await exportOtelSpans(client, spans);

Spans are converted to Amlexia events with method: 'OTEL' and provider hints from span attributes.

OTLP HTTP endpoint

Base: https://ingest.amlexia.com

PathFormat
POST /v1/otel/tracesOTLP protobuf or JSON (per deployment)

Include sdk_key in the request per Traces API.

Trace context in HTTP middleware

Middleware sets W3C traceparent on responses. Propagate it on internal calls:

typescript
import { createTraceContext, childSpan } from '@amlexiahq/node/tracing';

const parent = createTraceContext({ serviceName: 'api' });
const child = childSpan(parent);

Span attributes → provider detection

Shared parser reads host/url attributes and maps to providers (OpenAI, Stripe, etc.) — same registry as Supported providers.

Best practices

  • One serviceName per deployable (api, worker, nextjs).
  • Set releaseVersion / AMLEXIA_RELEASE to match deploys.
  • Do not put secrets in span attributes.