Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.
Rust
fix(observability): classify spans for Intake (#232)
nachiketb-nvidiac536c0a18d02
diff --git a/crates/libsy-llm-client/src/client.rs b/crates/libsy-llm-client/src/client.rsindex df6d3b91b..e60bdcd5c 100644--- a/crates/libsy-llm-client/src/client.rs+++ b/crates/libsy-llm-client/src/client.rs@@ -192,6 +192,7 @@ impl TranslatingLlmClient {attempt = attempt + 1,max_attempts,retry = attempt > 0,+ openinference.span.kind = "CHAIN",outcome = tracing::field::Empty,status_code = tracing::field::Empty,will_retry = tracing::field::Empty,diff --git a/crates/libsy/src/core/algorithm.rs b/crates/libsy/src/core/algorithm.rsindex 9339d482b..8f1bb877f 100644--- a/crates/libsy/src/core/algorithm.rs+++ b/crates/libsy/src/core/algorithm.rs@@ -192,6 +192,7 @@ impl Driver {fields(algorithm = observability::algorithm_label(&routed.ctx),selected_model = routed.decision.selected_model(),+ openinference.span.kind = "CHAIN",outcome = tracing::field::Empty,error = tracing::field::Empty,input_tokens = tracing::field::Empty,@@ -689,6 +690,7 @@ pub trait Algorithm: Send + Sync + 'static {selected_model = call.get_decision().selected_model(),otel.kind = "client",otel.name = %format_args!("chat {}", call.get_decision().selected_model()),+ openinference.span.kind = "LLM",gen_ai.operation.name = "chat",gen_ai.request.model = call.get_decision().selected_model(),gen_ai.request.stream = tracing::field::Empty,diff --git a/crates/libsy/src/observability.rs b/crates/libsy/src/observability.rsindex 96fed3d3f..61f0b01a8 100644--- a/crates/libsy/src/observability.rs+++ b/crates/libsy/src/observability.rs@@ -116,6 +116,7 @@ pub(crate) fn run_span(algorithm: &str, request: &Request) -> Span {"libsy.run",algorithm,switchyard.algorithm = algorithm,+ openinference.span.kind = "CHAIN",switchyard.route = tracing::field::Empty,session_id = tracing::field::Empty,session.id = tracing::field::Empty,diff --git a/crates/switchyard-server/src/observability.rs b/crates/switchyard-server/src/observability.rsindex fe3036cf2..b668a38a3 100644--- a/crates/switchyard-server/src/observability.rs+++ b/crates/switchyard-server/src/observability.rs@@ -55,6 +55,7 @@ pub(crate) fn request_span(headers: &HeaderMap) -> tracing::Span {target: "switchyard_server","switchyard.request",otel.kind = "server",+ openinference.span.kind = "CHAIN",);let _ = span.set_parent(parent);span