feat: record stream end mode in telemetry

llm_calls gains a nullable stream_end TEXT column (auto backfill,
manual-mode trimming as in 1.3.8). TelemetryRecorder.record_llm_call
takes a new required keyword stream_end; the emitter reads it from the
response on attempt rows and writes NULL for failed, cache-hit and
terminal rows.

Red: 18 tests in tests/unit/test_telemetry.py and test_ports.py failed
against the pre-change source (missing column, 38-field signature,
stream_end absent from emitted rows).
This commit is contained in:
2026-10-14 23:54:11 -04:00
parent 48ba36dd94
commit 779a9b29a3
7 changed files with 152 additions and 25 deletions
+3 -1
View File
@@ -150,6 +150,7 @@ class _DummyRecorder:
total_latency_ms,
stall_ms,
stall_count,
stream_end,
) -> None: ...
@@ -322,7 +323,7 @@ class TestTelemetryRecorderSignature:
"attempts",
"total_latency_ms",
} <= set(params)
assert len(params) - 1 == 38 # 减掉 self
assert len(params) - 1 == 39 # 减掉 self
@pytest.mark.parametrize(
"name",
@@ -341,6 +342,7 @@ class TestTelemetryRecorderSignature:
"error_body",
"attempts",
"total_latency_ms",
"stream_end",
],
)
def test_caller_dimensions_have_no_default(self, name):