@moostjs/otel
v0.6.6
Published
@moostjs/otel
Maintainers
Readme
@moostjs/otel
OpenTelemetry integration for Moost. Provides automatic tracing for event handlers, custom span creation, metrics collection, and trace propagation. Works by replacing Moost's context injector with a span-aware implementation.
Installation
npm install @moostjs/otel @opentelemetry/api @opentelemetry/sdk-trace-baseQuick Start
import { enableOtelForMoost } from '@moostjs/otel'
// Call before creating your Moost app
enableOtelForMoost()Composables
useOtelContext()— Access tracing utilities (span, propagation headers, custom attributes).useTrace()— Get the OpenTelemetrytraceAPI.useSpan()— Get the current event's root span.useOtelPropagation()— Get W3C trace-context headers for outgoing requests.
Decorators
@OtelIgnoreSpan()— Suppress span export for a controller or handler.@OtelIgnoreMeter()— Suppress metrics for a controller or handler.
Span Processors
MoostBatchSpanProcessor— Batch processor that respects@OtelIgnoreSpan().MoostSimpleSpanProcessor— Simple processor that respects@OtelIgnoreSpan().
Official Documentation
License
MIT
