feat: record call observability columns and terminal failure rows
Grow the telemetry contract from 26 to 36 fields and give every logical call a failure terminal row, so SQL can finally answer "how many calls failed" and "why did the whole pool die". Schema and port move together with the emitter writes in one commit: splitting them would ship columns that nothing populates. - schema: append 10 nullable columns (scope, operation, logical_call_id, event_kind, http_status_code, error_type, cause_type, error_body, attempts, total_latency_ms) to all five definition sites in one order - ports: 10 keyword-only parameters without defaults; the protocol signature is now the single source the assembly gate derives from - emitter: take domain exception objects instead of pre-flattened text and pin down the diagnostics in one helper; a relabelled 503 stays 503 and success rows leave all five columns NULL - emitter: reject recorders whose record_llm_call cannot accept the current field shape at assembly time, since _record would otherwise swallow the TypeError and drop every row while calls keep succeeding - clients: write at most one terminal row per logical call through a single shared exit, deduplicated by the call context; TelemetryMW stops writing terminals so the two sites cannot double count - clients: cancellation stays best effort and propagates, non-domain exceptions get no terminal row and keep their classification - transports: give _status_to_error an explicit operation and fix the historically mislabelled embedding HTTP failures - structured: promote the bounded error formatter so the reask feedback and the terminal explanation share one set of limits Terminal rows carry no cost and no tokens, so cost aggregation is unchanged; failure counts must now filter on event_kind.
This commit is contained in:
@@ -580,7 +580,12 @@ class TestReasonlessTelemetryContract:
|
||||
client, _ = _embed_client([_src(enable_thinking=True)], script, telemetry=recorder)
|
||||
with pytest.raises(AllSourcesExhausted if exhausted else RequestRejectedError):
|
||||
await client.embed(["text"])
|
||||
assert len(recorder.rows) == len(script)
|
||||
# 1.3.5: 逐次 attempt 行之外,本次逻辑调用另有**一条**终态行
|
||||
attempts = [r for r in recorder.rows if r["event_kind"] == "attempt"]
|
||||
terminals = [r for r in recorder.rows if r["event_kind"] == "terminal_failure"]
|
||||
assert len(attempts) == len(script)
|
||||
assert len(terminals) == 1
|
||||
# 推理档在三类行上都必须是 NULL: embed payload 从不带推理参数
|
||||
assert all(r["error"] and r["reasoning_effort"] is None for r in recorder.rows)
|
||||
|
||||
async def test_embedding_wire_ignores_reasoning_configuration(self):
|
||||
|
||||
Reference in New Issue
Block a user