KatInterview

Build a Usage and Quality Metrics Console for an LLM Chatbot

System DesignModel answer
MediumModel answerSystem Designobservabilityolapkafka

Last updated

Design a metrics pipeline and console for a multi-tenant LLM chatbot that ingests about 5k events/s and supports sliceable, low-latency queries with 30-day detail and 1-year rollups.

Scenario

Your company runs a conversational assistant powered by large language models. Hundreds of enterprise customers (tenants) use it, and the platform serves traffic from several geographic regions. You are asked to design the metrics console that tenants and internal operators use to understand how the assistant is behaving.

What the console must report

  • Number of conversations/requests handled
  • Response latency (the product team wants to know whether a plain average is enough)
  • Token consumption per request
  • Failure rate for each model

Scale

  • Roughly 5,000 requests per second in aggregate, with bursts above that
  • Several hundred tenants
  • Each request can be described by: tenant, model version, region, client platform (web or mobile), outcome, and error code

Functional requirements

  1. Capture each chat request (latency, token counts, success or failure) in near real time.
  2. Chart the metrics over 1-minute, 1-hour, and 1-day buckets.
  3. Let users filter and group by any combination of dimensions, for example: "error rate of model X in North America for tenant Y."

Non-functional requirements

  1. Highly available, with fast dashboard queries.
  2. Storage that copes with many dimension combinations (high cardinality).
  3. Retention: 30 days of fine-grained data and 1 year of daily rollups.

What to cover in your answer

  • How the chat service is instrumented without hurting user-facing latency
  • The streaming and buffering path from the service to storage
  • Choice of storage and aggregation approach (time-series database versus an analytical column store), and how rollups are produced
  • How you keep high-cardinality dimensions, such as tenant, from overwhelming the system
  • Tenant isolation, caching, failure behavior, and the main trade-offs

State any assumptions and rough capacity numbers you rely on.

Hints

Hint 1

Start with arithmetic: 5k events/s is about 430M events/day. Estimate bytes per event and compression to see whether the 30-day raw data fits on a small cluster.

Hint 2

Ask whether latency is reported as an average or a percentile. Percentiles cannot be averaged across buckets, so think about what you store in rollups so they can still be merged later.

Hint 3

Compare a store that creates one series per label combination with a column store where dimensions are plain columns. Which one suffers when tenant x model x region x platform multiplies?

Hint 4

Decide what must never be part of an aggregation key (request IDs, user IDs, free-text errors) and how you would still answer questions about them.