Group pipeline runs into Langfuse sessions, tagged by trigger source

Each pipeline invocation (runAsync/searchAsync) now gets a fresh
sessionId, wrapped via the new Tracer.runWithSession() (implemented
with @langfuse/tracing's propagateAttributes, since v5 has no direct
sessionId/tags option on startObservation) so it shows up in
Langfuse's Sessions view. The session is also tagged with what
triggered the run: "cron", "api-list", "api-trigger", "api-search".

Verified: full test suite (79/79) passing, tsc/eslint clean, real
docker compose build + container smoke test against /health.
This commit is contained in:
2026-08-12 22:51:17 +02:00
parent b615f08039
commit e47c57b50d
10 changed files with 135 additions and 52 deletions

View File

@@ -25,6 +25,7 @@ function makeTracer() {
const tracer = {
startTrace: vi.fn().mockReturnValue(trace),
flush: vi.fn().mockResolvedValue(undefined),
runWithSession: vi.fn().mockImplementation((_session: unknown, fn: () => unknown) => fn()),
} as unknown as Tracer;
return tracer;
}