/** * OpenTelemetry wiring for the broker. * * The contract from CLAUDE.md: OTEL is the only observability stack. The * SDK shape is `@opentelemetry/sdk-node`; exporters are chosen at process * boundary by the caller's environment: * * - **Local dev / lgtm loop**: OTLP gRPC exporters point at * `grafana/otel-lgtm` (or any OTLP receiver). `OTEL_EXPORTER_OTLP_ENDPOINT` * env var (default `http://localhost:4317`) is honoured. * - **Cloud (Application Insights)**: the caller passes an * `@azure/monitor-opentelemetry-exporter` instance via the * `traceExporter`/`metricExporter` options below — keeps the App * Insights dependency out of the library's production dep tree. * * Either way the broker itself is unaware — instrumentation is always-on via * the OTel API; the SDK is opt-in at the process boundary. Tests and * library-embedded usages that never call `initOtel()` get the API's * no-op tracer/meter (zero overhead). */ import { type PushMetricExporter } from '@opentelemetry/sdk-metrics'; import { NodeSDK } from '@opentelemetry/sdk-node'; import type { SpanExporter } from '@opentelemetry/sdk-trace-node'; export type OtelInitOptions = { /** Override the OTLP endpoint. Defaults to OTEL_EXPORTER_OTLP_ENDPOINT env var, then http://localhost:4317. */ readonly endpoint?: string; /** Override service.name. Defaults to "blob-data-streamer". */ readonly serviceName?: string; /** Override service.namespace. */ readonly serviceNamespace?: string; /** Override service.instance.id. Surfaces in App Insights as `cloud_RoleInstance`. */ readonly serviceInstanceId?: string; /** Override service.version. Defaults to the package version. */ readonly serviceVersion?: string; /** Metric export interval in milliseconds. Defaults to 10 000. */ readonly metricIntervalMs?: number; /** * Plug in an alternative trace exporter. When omitted, the OTLP-gRPC * default is used. Pass an `AzureMonitorTraceExporter` here to ship * spans to App Insights without dragging the * `@azure/monitor-opentelemetry-exporter` dependency into the * library's production dep tree. */ readonly traceExporter?: SpanExporter; /** Plug in an alternative metric exporter. Same rationale as `traceExporter`. */ readonly metricExporter?: PushMetricExporter; /** * Extra resource attributes merged into the SDK resource. Useful for * tagging every signal with `cloud.platform`, `cloud.region`, * `service.namespace`, etc. */ readonly resourceAttributes?: Record; }; /** * Start the OTEL SDK. Idempotent — second and subsequent calls are no-ops. * Returns the SDK instance for tests that want to flush + shutdown explicitly. */ export declare function initOtel(options?: OtelInitOptions): NodeSDK; export declare function shutdownOtel(): Promise; /** * Get the OTEL tracer for broker instrumentation. Safe to call before * `initOtel()` — returns the API's no-op tracer in that case, so library code * never has to check whether OTEL is on. */ export declare function getTracer(): import("@opentelemetry/api").Tracer; /** * Get the OTEL meter for broker instrumentation. Same no-op-when-off contract * as `getTracer()`. */ export declare function getMeter(): import("@opentelemetry/api").Meter; //# sourceMappingURL=otel.d.ts.map