OpenTelemetry exporter
@provantix/otel-exporter is an OpenTelemetry SpanExporter. An existing OTel GenAI setup adds one exporter and nothing else — no wrappers around your model calls, no changes to business code. Every span that carries gen_ai.* semantic-convention attributes becomes a signed, hash-chained, offline-verifiable record on the same /v1/batches path as the rest of the platform.
Install
npm install @provantix/otel-exporter
Node 20+, no runtime dependencies. Published on npm as @provantix/otel-exporter; source in the agent-sdk repo.
One-line setup
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
import { ProvantixSpanExporter } from '@provantix/otel-exporter';
const provider = new NodeTracerProvider();
provider.addSpanProcessor(new BatchSpanProcessor(new ProvantixSpanExporter({
emitterId: 'emi_01m…', // from emitter registration
tenantId: 'ten_org_01m…', // your organization's tenant
privateKeyPem: process.env.PROVANTIX_PRIVATE_KEY_PEM.replace(/\\n/g, '\n'),
endpoint: 'https://app.provantix.tech',
spoolDir: '/var/spool/provantix', // durable offline queue (recommended)
})));
That's the whole integration. Approvals (provantix.approval.* attributes) and delegation chains (reconstructed from span parentage) ride along automatically, and agent attribution matches on the trace.metadata.agent_id attribute — the same key every path uses.
Wiring the common GenAI instrumentations
The exporter consumes standard OTel GenAI semantic conventions, so any instrumentation that emits them works without further configuration:
| Instrumentation | How it emits | What to check |
|---|---|---|
OpenAI (official JS SDK, openai ≥ 4.60 with OTel, or @opentelemetry/instrumentation-openai) |
gen_ai.operation.name, gen_ai.system, token usage |
Requires openai.telemetry() / an enabled OTel provider; the provider above must be registered globally (provider.register()). |
Anthropic (@anthropic-ai/sdk with OTel beta, or the community instrumentation) |
gen_ai.operation.name, gen_ai.system |
Check the SDK version emits semconv names (gen_ai.*), not vendor-private attribute names. |
LangChain JS (@langchain/core callbacks → OTel, or LangChainTracer) |
gen_ai.* on LLM/tool spans |
Point LangChain's tracer at the same provider; tool spans carry gen_ai.tool.name. |
Vercel AI SDK (experimental_telemetry / ai OTel) |
ai.* and gen_ai.* |
recordInputs: false recommended — we never need raw payloads, only attributes. |
Set trace.metadata.agent_id (for example via tracer.startSpan attributes or your instrumentation's metadata hook) to the agent's platform id and records attribute at full confidence.
What it costs
Zero added latency on the request path by design: the OTel BatchSpanProcessor calls export() after span end, on its own timer — never inside a request. Inside export() the exporter does only CPU work (span normalization, the gen_ai.* → record mapping, boundary gating, one ECDSA batch seal) plus the per-batch durability writes that make the offline queue crash-safe. Network I/O happens only on a background drain timer. The exporter can also never break your app: every internal failure is counted and reported as success to the SDK.
Measured on 2026-10-24, AMD Ryzen 9 7950X, Node v24.21.0, Windows 11 — reproducer in the package (npm run benchmark):
| Metric | Value |
|---|---|
Added latency per export() call (32 spans), p50 |
3.72 ms (≈ 0.12 ms per span) |
Added latency per export() call, p99 |
8.49 ms |
| Throughput, export-side path | ~7,600 spans/s |
| CPU | ~139 ms per 1,000 spans |
| Heap delta over 64,000 spans | ~14 MB (includes GC not yet run) |
| Signed batch size (avg) | ~80 KB / 32 records |
| One-hour outage spool | 120 batches (3,840 spans), 9.1 MB |
| Recovery drain after outage | all 120 batches shipped in order, ~85 ms |
Two things the table says plainly. The per-batch cost is dominated by the durability writes (each signed batch is on disk before the exporter acknowledges it) — that is the price of the custody guarantee, not overhead. And the outage leg is the point of the design: telemetry keeps flowing, the spool grows linearly, and recovery ships everything in sequence order with no loss and no duplicates.
API
| Member | Meaning |
|---|---|
export(spans, resultCallback) |
OTel contract; invoked by the span processor |
forceFlush() |
Seal pending records and ship until the spool is empty or the plane is unreachable |
shutdown() |
Stop the drain timer; final best-effort ship — call at process exit |
stats |
spans received/mapped, batches sealed/sent, spool batches/bytes, last export ms, last error |
isDrained() |
true when every sealed batch has been acknowledged |
Privacy posture
Same boundary guarantees as the collector: human identifiers leave as HMAC handles, text content is redacted with the default profile and truncated at 2 KB before sealing, and the erasable summaries are committed as salted hashes so the evidence chain verifies without carrying raw payloads. Set spoolDir so the queue and the handle key survive restarts.