SteelReed

Search

Search posts, questions…

AI & LLMQuestion 9 / 25

Middle

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.

only when neededEach LLM callMetric: tokens, model,feature, prompt_versionTrace: one span per callContent: sampled,PII filtered

3 points to say:

  1. A log line POST /reply 200 4.2s can't tell which request burned 40,000 tokens; one user request is many calls, each turn resending the whole context.
  2. Use the OpenTelemetry GenAI conventions (gen_ai.usage.input_tokens…), still at Development stability, so names may change; Spring AI emits them via Micrometer.
  3. 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.