Skip to content

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

feat: parse tag.tags properties on otel (#10117)

Steffen Schmitzf0966a07c477
diff --git a/packages/shared/src/server/otel/OtelIngestionProcessor.ts b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
index fa7746f644..ed3b339eb8 100644
--- a/packages/shared/src/server/otel/OtelIngestionProcessor.ts
+++ b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
@@ -966,6 +966,8 @@ export class OtelIngestionProcessor {
`ai.telemetry.metadata.sessionId`,
`ai.telemetry.metadata.userId`,
`ai.telemetry.metadata.tags`,
+ // LlamaIndex
+ `tag.tags`,
].some((traceAttribute) => Boolean(attributes[traceAttribute]));
const attributeKeys = Object.keys(attributes);
@@ -1954,7 +1956,8 @@ export class OtelIngestionProcessor {
attributes[
`${LangfuseOtelSpanAttributes.TRACE_METADATA}.langfuse_tags`
] ||
- attributes["ai.telemetry.metadata.tags"];
+ attributes["ai.telemetry.metadata.tags"] ||
+ attributes["tag.tags"];
if (tagsValue === undefined || tagsValue === null) {
return [];
diff --git a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
index 3a064a7a0c..b1d9e7549a 100644
--- a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
+++ b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts
@@ -2122,6 +2122,63 @@ describe("OTel Resource Span Mapping", () => {
entityAttributeValue: ["2", "3", "4"],
},
],
+ [
+ "should extract tags from tag.tags single string to trace",
+ {
+ entity: "trace",
+ otelAttributeKey: "tag.tags",
+ otelAttributeValue: {
+ stringValue: "llamaindex",
+ },
+ entityAttributeKey: "tags",
+ entityAttributeValue: ["llamaindex"],
+ },
+ ],
+ [
+ "should extract tags from tag.tags array value to trace",
+ {
+ entity: "trace",
+ otelAttributeKey: "tag.tags",
+ otelAttributeValue: {
+ arrayValue: {
+ values: [
+ {
+ stringValue: "llamaindex",
+ },
+ {
+ stringValue: "rag",
+ },
+ ],
+ },
+ },
+ entityAttributeKey: "tags",
+ entityAttributeValue: ["llamaindex", "rag"],
+ },
+ ],
+ [
+ "should extract tags from tag.tags JSON string array to trace",
+ {
+ entity: "trace",
+ otelAttributeKey: "tag.tags",
+ otelAttributeValue: {
+ stringValue: '["llamaindex", "rag", "production"]',
+ },
+ entityAttributeKey: "tags",
+ entityAttributeValue: ["llamaindex", "rag", "production"],
+ },
+ ],
+ [
+ "should extract tags from tag.tags comma-separated string to trace",
+ {
+ entity: "trace",
+ otelAttributeKey: "tag.tags",
+ otelAttributeValue: {
+ stringValue: "llamaindex, rag, production",
+ },
+ entityAttributeKey: "tags",
+ entityAttributeValue: ["llamaindex", "rag", "production"],
+ },
+ ],
[
"should map gen_ai.input.messages to input",
{