What should you measure for an LLM call in production?
Short answer
Each call needs: requested model and the model actually returned, input, output and cache-read tokens, duration, finish_reason, plus two business labels: feature and prompt version.
3 points to say:
- A log line
POST /reply 200 4.2scan't tell which request burned 40,000 tokens; one user request is many calls, each turn resending the whole context. - Use the OpenTelemetry GenAI conventions (
gen_ai.usage.input_tokens…), still at Development stability, so names may change; Spring AI emits them via Micrometer. - Metrics get only low-cardinality labels, no
user_id; content only when needed, PII filtered.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.