API reference

yatta/otel

OpenTelemetry tracing, bridged into the observe dashboard.

6 exported symbols and 3 members, read from src/types/otel.ts.

Construct

enableOpenTelemetry

function

Enable OpenTelemetry integration.

This does NOT set up the OTel SDK — you must configure that separately (e.g., with

enableOpenTelemetry(config?: OtelConfig): void

getOtelTracer

function

Get the OTel tracer, or null if not enabled.

getOtelTracer(): Tracer | null

isOpenTelemetryEnabled

function

Check if OpenTelemetry bridging is enabled.

isOpenTelemetryEnabled(): boolean

startOtelSpan

function

Start an OTel span directly (for custom instrumentation).

startOtelSpan(name: string, options?: { kind?: OtelSpanKind; attributes?: Record<string, string | number | boolean>; }): OtelSpan | null

withOtelSpan

async function

Run a function within an OTel span context.

withOtelSpan<T>(name: string, fn: (span: OtelSpan) => Promise<T>, options?: { kind?: OtelSpanKind; attributes?: Record<string, string | number | boolean>; }): Promise<T>

Types

OtelConfig

interface
interface OtelConfig

3 members

  • tracerNameproperty
    tracerName?: string

    Tracer name for OTel spans (default: "yatta")

  • versionproperty
    version?: string

    Tracer version

  • bridgeSpansproperty
    bridgeSpans?: boolean

    Whether to bridge Yatta spans to OTel (default: true)

Tip
Most of the types above are inferred. You rarely import AuthConfig or JobPayload — declaring your schema once is enough for the rest to follow. See Typed keys.