mod openinference#

module openinference#

OpenInference subscriber support for NeMo Flow.

This crate adapts NeMo Flow lifecycle events into OpenInference trace spans:

  • scope/tool/LLM Start events open spans

  • matching End events close spans

  • Mark events become span events on the active parent span when possible

  • orphan marks fall back to zero-duration spans so they still reach OTLP

The public API is intentionally small:

Types

type Result<T>#

Result type for the OpenInference subscriber crate.

Enums

enum OpenInferenceError#

Errors produced while configuring or operating the OpenInference 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.

Core(FlowError)#

Registration errors from the core runtime.

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 OpenInferenceConfig#

Configuration for the OpenInference subscriber.

Implementations

impl OpenInferenceConfig#

Functions

fn new() -> Self#

Creates a config with sensible defaults.

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_name(mut self, service_name: impl Into<String>) -> Self#

Sets the service.name resource attribute.

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.

fn with_transport(mut self, transport: OtlpTransport) -> Self#

Selects the OTLP transport.

Traits implemented

impl Default for OpenInferenceConfig#
struct OpenInferenceSubscriber#

OpenInference-backed NeMo Flow subscriber.

Implementations

impl OpenInferenceSubscriber#

Functions

fn deregister(&self, name: &str) -> Result<bool>#

Deregisters a previously-registered global subscriber by name.

fn force_flush(&self) -> Result<()>#

Flushes finished spans through the underlying tracer provider.

fn from_tracer_provider(provider: SdkTracerProvider, instrumentation_scope: impl Into<String>) -> Self#

Builds a subscriber from an already-configured tracer provider.

fn new(config: OpenInferenceConfig) -> 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.