@moostjs/otel
v0.6.27
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-baseNote: @moostjs/event-http is a required peer dependency — install it even if your app only handles CLI or workflow events.
Quick 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 trace-context propagation data (span 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
