Skip to content

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

feat(otel): tag x-langfuse-ingestion-version header on OTel API spans (#15076)

Max Deichmann76bfe6dd6a37
diff --git a/web/src/pages/api/public/otel/v1/traces/index.ts b/web/src/pages/api/public/otel/v1/traces/index.ts
index 1ea56b7119..9701735288 100644
--- a/web/src/pages/api/public/otel/v1/traces/index.ts
+++ b/web/src/pages/api/public/otel/v1/traces/index.ts
@@ -1,6 +1,7 @@
import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";
import { createAuthedProjectAPIRoute } from "@/src/features/public-api/server/createAuthedProjectAPIRoute";
import {
+ getCurrentSpan,
logger,
markProjectIngestFailure,
OtelIngestionProcessor,
@@ -134,6 +135,12 @@ export default withMiddlewares({
req.headers,
"x-langfuse-ingestion-version",
);
+ if (ingestionVersion) {
+ getCurrentSpan()?.setAttribute(
+ "langfuse.ingestion.version",
+ ingestionVersion,
+ );
+ }
// Reject unsupported future ingestion versions (> 4)
// Lower versions are valid but use dual write (path A)