mod otel#
- module otel#
OpenTelemetry subscriber support for NeMo Flow.
This crate adapts NeMo Flow lifecycle events into OpenTelemetry trace spans:
scope/tool/LLM
Startevents open spansmatching
Endevents close spansMarkevents become span events on the active parent span when possibleorphan marks fall back to zero-duration spans so they still reach OTLP
The public API is intentionally small:
OpenTelemetryConfigconfigures the OTLP exporter and resource metadataOpenTelemetrySubscriberexposes a NeMo FlowEventSubscriberFnand convenienceregister/deregister/force_flush/shutdownmethods
Types
- type Result<T>#
Result type for the OpenTelemetry subscriber crate.
Enums
- enum OpenTelemetryError#
Errors produced while configuring or operating the OpenTelemetry subscriber.
- MissingTokioRuntime#
The tonic gRPC exporter requires an active Tokio runtime.
- UnsupportedTransport#
The requested transport is not available on this target.
- transport: &'static str#
Human-readable transport label used in the error message.
- InvalidGrpcHeader#
Failed to parse a configured gRPC metadata header.
- key: String#
Header name that failed to parse.
- message: String#
Parser failure message.
- ExporterBuild(String)#
Failed to build the OTLP exporter.
- Provider(String)#
The underlying tracer provider returned an error.
- enum OtlpTransport#
Supported OTLP trace transports.
- HttpBinary#
OTLP/HTTP protobuf, typically
http://host:4318/v1/traces.
- Grpc#
OTLP/gRPC, typically
http://host:4317.
Structs and Unions
- struct OpenTelemetryConfig#
Configuration for the OpenTelemetry subscriber.
Implementations
- impl OpenTelemetryConfig#
Functions
- fn grpc(service_name: impl Into<String>) -> Self#
Creates a gRPC OTLP config for the given service name.
- fn http_binary(service_name: impl Into<String>) -> Self#
Creates an HTTP OTLP config for the given service name.
- fn with_endpoint(mut self, endpoint: impl Into<String>) -> Self#
Overrides the OTLP endpoint. If unset, exporter defaults and OTEL_* env vars apply.
- fn with_header(mut self, key: impl Into<String>, value: impl Into<String>) -> Self#
Adds a header/metadata entry for the exporter.
- fn with_instrumentation_scope(mut self, scope: impl Into<String>) -> Self#
Sets the instrumentation scope name used for emitted spans.
- fn with_resource_attribute(mut self, key: impl Into<String>, value: impl Into<String>) -> Self#
Adds a resource attribute as a string key/value pair.
- fn with_service_namespace(mut self, namespace: impl Into<String>) -> Self#
Sets the service namespace resource attribute.
- fn with_service_version(mut self, version: impl Into<String>) -> Self#
Sets the service version resource attribute.
- fn with_timeout(mut self, timeout: Duration) -> Self#
Sets the OTLP request timeout.
Traits implemented
- impl Default for OpenTelemetryConfig#
- struct OpenTelemetrySubscriber#
OpenTelemetry-backed NeMo Flow subscriber.
Implementations
- impl OpenTelemetrySubscriber#
Functions
- fn deregister(&self, name: &str) -> Result<bool>#
Deregisters a previously-registered global subscriber by name.
- fn from_tracer_provider(provider: SdkTracerProvider, instrumentation_scope: impl Into<String>) -> Self#
Builds a subscriber from an already-configured tracer provider.
- fn new(config: OpenTelemetryConfig) -> Result<Self>#
Builds a subscriber backed by a new OTLP tracer provider.
- fn register(&self, name: &str) -> Result<()>#
Registers this subscriber globally with the NeMo Flow runtime.
- fn shutdown(&self) -> Result<()>#
Shuts down the underlying tracer provider.
Call
deregister(...)first if the subscriber is still registered with NeMo Flow.
- fn subscriber(&self) -> EventSubscriberFn#
Returns the raw NeMo Flow subscriber callback for custom registration flows.