Task · CFO-0008

AI Gateway log collector: logs, GenAI traces and metrics

Description

REST /ai-gateway/gateways/{g}/logs. Decision 2026-09-23 (Rob): bodies opt-in, enabled on camden with a size cap; cf2otel becomes the only AI Gateway trace source and must be a strict superset of the native cf.aig.request span (doc-0003 section 4).

Acceptance Criteria

Definition of Done

Implementation Notes

Parked AC4: live v0.1.3 produced 62 matched native/cf2otel spans with all eight native attribute keys on those matches, but failed pre-checkpoint window attempts emitted duplicates. Loki had 222 AI Gateway rows for 69 unique log IDs, 153 duplicates, max six copies. Resume with atomic window delivery or dedupe and a fresh restart/failure proof.

Finding 2026-09-23 (wave 2 prep): Grafana Cloud Tempo on the m7kni stack stores gen_ai.input.messages / gen_ai.output.messages truncated at exactly 2048 characters (8 spans checked, v0.1.2 and v0.1.3; no SDK attribute limit or OTEL_ env is set in cf2otel or on camden, so the truncation is Tempo-side). The wave 1 comparison proved key presence, not content fidelity. Decision 2026-09-23 (Rob): keep full capped bodies on spans (the Tempo limit may be raised by Rob; out of wave scope) and also emit them as a correlated log record so full content is retained in Loki.

View the source file on GitHub