Skip to content

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

chore: add new metric for event byte length (#9710)

Steffen Schmitz6d4b0854333d
diff --git a/packages/shared/src/server/otel/OtelIngestionProcessor.ts b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
index 7aa6450f62..a44db0f26b 100644
--- a/packages/shared/src/server/otel/OtelIngestionProcessor.ts
+++ b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
@@ -16,6 +16,7 @@ import {
getS3EventStorageClient,
QueueJobs,
instrumentSync,
+ recordDistribution,
} from "../";
import { LangfuseOtelSpanAttributes } from "./attributes";
@@ -248,6 +249,16 @@ export class OtelIngestionProcessor {
const scopeVersion = scopeSpan?.scope?.version;
const stringifiedSpan = JSON.stringify(span);
+ const eventBytes = Buffer.byteLength(stringifiedSpan, "utf8");
+
+ recordDistribution(
+ "langfuse.ingestion.otel.event.byte_length",
+ eventBytes,
+ {
+ source: "otel",
+ sdk_language: telemetrySdkLanguage || "",
+ },
+ );
events.push({
projectId: this.projectId,
@@ -339,7 +350,7 @@ export class OtelIngestionProcessor {
// Source data
// eventRaw: stringifiedSpan,
- eventBytes: Buffer.byteLength(stringifiedSpan, "utf8"),
+ eventBytes,
});
}
}