Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat: parse mlflow attributes on otel spans (#5609)

Steffen Schmitzc233c7fa8d95
diff --git a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
index 988d3f2715..5062d6fbc5 100644
--- a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
+++ b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
@@ -525,6 +525,34 @@ describe("OTel Resource Span Mapping", () => {
entityAttributeValue: "Observing LLMs",
},
],
+ [
+ "should map mlflow.spanInputs to input",
+ {
+ entity: "observation",
+ otelAttributeKey: "mlflow.spanInputs",
+ otelAttributeValue: {
+ stringValue: JSON.stringify({
+ question: "What is LLM Observability?",
+ }),
+ },
+ entityAttributeKey: "input",
+ entityAttributeValue: JSON.stringify({
+ question: "What is LLM Observability?",
+ }),
+ },
+ ],
+ [
+ "should map model to model",
+ {
+ entity: "observation",
+ otelAttributeKey: "model",
+ otelAttributeValue: {
+ stringValue: "gpt-4o-mini",
+ },
+ entityAttributeKey: "model",
+ entityAttributeValue: "gpt-4o-mini",
+ },
+ ],
[
"#5412: should map input.value to input for smolagents",
{
diff --git a/web/src/features/otel/server/index.ts b/web/src/features/otel/server/index.ts
index 59a28744b0..290f56d265 100644
--- a/web/src/features/otel/server/index.ts
+++ b/web/src/features/otel/server/index.ts
@@ -131,6 +131,13 @@ const extractInputAndOutput = (
return { input, output };
}
+ // MLFlow sets mlflow.spanInputs and mlflow.spanOutputs
+ input = attributes["mlflow.spanInputs"];
+ output = attributes["mlflow.spanOutputs"];
+ if (input || output) {
+ return { input, output };
+ }
+
// TraceLoop sets traceloop.entity.input and traceloop.entity.output
input = attributes["traceloop.entity.input"];
output = attributes["traceloop.entity.output"];
@@ -225,6 +232,7 @@ const extractModelName = (
"gen_ai.request.model",
"gen_ai.response.model",
"llm.model_name",
+ "model",
];
for (const key of modelNameKeys) {
if (attributes[key]) {