pub trait SpanCombinator {
// Required methods
fn record_token_usage<U>(&self, usage: &U)
where U: GetTokenUsage;
fn record_response_metadata<R>(&self, response: &R)
where R: ProviderResponseExt;
fn record_model_input<T>(&self, messages: &T)
where T: Serialize;
fn record_model_output<T>(&self, messages: &T)
where T: Serialize;
}Expand description
A trait designed specifically to be used with Spans for the purpose of recording telemetry.
Implemented for tracing::Span to record GenAI semantic convention fields.
Required Methods§
Sourcefn record_token_usage<U>(&self, usage: &U)where
U: GetTokenUsage,
fn record_token_usage<U>(&self, usage: &U)where
U: GetTokenUsage,
Record Rig-normalized token usage fields on the span.
Sourcefn record_response_metadata<R>(&self, response: &R)where
R: ProviderResponseExt,
fn record_response_metadata<R>(&self, response: &R)where
R: ProviderResponseExt,
Record provider response metadata such as response ID and model name.
Sourcefn record_model_input<T>(&self, messages: &T)where
T: Serialize,
fn record_model_input<T>(&self, messages: &T)where
T: Serialize,
Record serialized model input messages.
Sourcefn record_model_output<T>(&self, messages: &T)where
T: Serialize,
fn record_model_output<T>(&self, messages: &T)where
T: Serialize,
Record serialized model output messages.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.