feat(otel): propagate session.id to spans and log records (#7490)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -459,6 +459,10 @@ pub trait Provider: Send + Sync {
|
||||
fn get_name(&self) -> &str;
|
||||
|
||||
/// Primary streaming method that all providers must implement.
|
||||
///
|
||||
/// Note: Do not add `#[instrument]` here — the call sites (`complete` and
|
||||
/// `stream_response_from_provider`) create the telemetry span so that
|
||||
/// `session.id` is set once rather than in every provider.
|
||||
async fn stream(
|
||||
&self,
|
||||
model_config: &ModelConfig,
|
||||
@@ -469,6 +473,10 @@ pub trait Provider: Send + Sync {
|
||||
) -> Result<MessageStream, ProviderError>;
|
||||
|
||||
/// Complete with a specific model config.
|
||||
#[tracing::instrument(
|
||||
skip(self, model_config, session_id, system, messages, tools),
|
||||
fields(session.id = %session_id, gen_ai.request.model = %model_config.model_name)
|
||||
)]
|
||||
async fn complete(
|
||||
&self,
|
||||
model_config: &ModelConfig,
|
||||
|
||||
Reference in New Issue
Block a user