feat(langfuse): filter out non-tool-call spans from export

This commit is contained in:
2026-07-08 12:16:02 +05:30
parent 8c565ecc8a
commit 1201486e6a
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -65,8 +65,12 @@ export function initializeLangfuseTransport(): void {
provider = new NodeTracerProvider({
spanProcessors: [
new LangfuseSpanProcessor({
// Export all spans, not just LLM-relevant ones
shouldExportSpan: () => true,
// Only export tool-call spans, skip health checks and protocol noise
shouldExportSpan: (span) => {
const mcpMethod = span.otelSpan.attributes["mcp_method"];
if (mcpMethod === "tools/call") return true;
return !mcpMethod;
},
}),
],
});
+1
View File
@@ -329,6 +329,7 @@ export async function main() {
}),
method: c.req.method,
client_ip: clientIp,
mcp_method: mcpInfo.method ?? "",
},
async () => {
const op = log.start(LogOperation.HANDLING_MCP_HTTP_REQUEST, {