Skip to content

v0.1.8 — OpenTelemetry opt-in

Latest

Choose a tag to compare

@Seenfinity Seenfinity released this 23 May 00:03
· 1 commit to main since this release

Mirror of @voightxyz/openai@0.1.7 — same otel: true flag, same gen_ai.* + ai.* attribute shape, same voight.source: 'wrapper' dedup marker, same optional peer on @opentelemetry/api.

New option

import Anthropic from '@anthropic-ai/sdk'
import { wrapAnthropic } from '@voightxyz/anthropic'

const anthropic = wrapAnthropic(new Anthropic(), {
  agent: 'production-chat-api',
  otel: true,           // ← new
})

When otel: true, every captured messages.create event is also written as an OpenTelemetry span named voight.anthropic.messages with gen_ai.system: 'anthropic', model, token counts, finish reason, and the voight.source: 'wrapper' dedup marker.

What didn't change

  • Default otel: false is byte-identical to 0.1.7. Existing users see no behaviour change.
  • @opentelemetry/api is an optional peer dep. Projects that never set otel: true are unaffected.
  • When otel: true is set but the package isn't installed, the wrapper falls back to direct ingestion only.

Differences from the OpenAI port

  • Span name is voight.anthropic.messages (Anthropic exposes the Messages API, not chat.completions).
  • gen_ai.system resolves to anthropic.

Companion releases

Validation

Tests: 92 → 109 green (17 new). B.8.4: removing the voight.source stamp triggers 3 failures, matching the OpenAI port.

End-to-end smoke from the npm registry: real Anthropic call with otel: true + VoightExporter in the same OTel runtime → exactly 1 POST to /v1/events per call.

Install

npm install @voightxyz/anthropic @opentelemetry/api

Links