Skip to content
Night Owls.dev
Jump to a page

@nightowlsdev/telemetry-otel

Telemetry

OTLP/HTTP telemetry exporter for @nightowlsdev/core that ships swarm traces to any OpenTelemetry-compatible backend.

What it does

A thin adapter over @nightowlsdev/telemetry-core that maps a swarm run's run/generation/tool spans to OpenTelemetry and exports them over OTLP/HTTP via a BatchSpanProcessor to any compatible backend (Datadog, New Relic, Honeycomb, Grafana Tempo, Jaeger, or a plain OpenTelemetry Collector) just by changing url + headers. Generation spans carry gen_ai.* semantic-convention attributes (model, input/output tokens, cost). Call otelTelemetry({ url, headers, serviceName?, resourceAttributes? }) and hand it to defineSwarm({ telemetry }); the replayer awaits forceFlush() after each run's batch so spans aren't lost in short-lived invocations. Also exports nightOwlsPlugin, the declarative CLI plugin manifest for @nightowlsdev/cli. Telemetry is best-effort.

Install

pnpm add @nightowlsdev/telemetry-otel

Key exports

  • otelTelemetry
  • nightOwlsPlugin
  • OtelTelemetryOpts (type)

Usage

telemetry-otel.ts
import { defineSwarm } from "@nightowlsdev/core";
import { otelTelemetry } from "@nightowlsdev/telemetry-otel";

const telemetry = otelTelemetry({
  url: "https://otlp.example.com/v1/traces",
  headers: { authorization: `Bearer ${process.env.OTLP_TOKEN}` },
});

const swarm = defineSwarm({ agents, telemetry });