If Consumer Lag Is Not an SLI, Then What Is It?

Every team that runs Kafka ends up putting consumer lag on a dashboardand treating it as enough. It's the simplest number available: the count ofmessages that haven't been processed yet. But lag only answers a throughputquestion: is the consumer group keeping up with what's being produced to thetopic? It doesn't answer the question the business actually cares about: howlong does it take, from the moment an event occurs, for the system to finishresponding?

Those are different questions, and incidents hide in the gap betweenthem. A system with zero lag can still fail its users. It might commit offsetsbefore processing and lose messages when it crashes. It might route everyfailing message to a retry or dead-letter topic, so the main topic clearscleanly while nothing actually succeeds. Or the event might still have to waitbehind three more asynchronous steps before it reaches the customer's inbox.Lag tells you about one queue. It says nothing about the pipeline as a whole.

Key takeaway #1

Lag measures backlog, not experience: Consumer lag onlytells you how big the backlog is at one hop. It says nothing about what yourusers actually experience.

Key takeaway #2

Track end-to-end freshness: What really matters inan asynchronous pipeline is how long it takes for an event to show up as anobservable effect. That's the SLI to track.

Key takeaway #3

Redefine your error budget: In an async flow, theerror budget isn't an uptime percentage. It's the share of events allowed tomiss a freshness threshold over a given period, including events that neverarrive at all.

If Consumer Lag Is Not an SLI, Then What Is It?

Every team that runs Kafka ends up putting consumer lag on a dashboardand treating it as enough. It's the simplest number available: the count ofmessages that haven't been processed yet. But lag only answers a throughputquestion: is the consumer group keeping up with what's being produced to thetopic? It doesn't answer the question the business actually cares about: howlong does it take, from the moment an event occurs, for the system to finishresponding?

Those are different questions, and incidents hide in the gap betweenthem. A system with zero lag can still fail its users. It might commit offsetsbefore processing and lose messages when it crashes. It might route everyfailing message to a retry or dead-letter topic, so the main topic clearscleanly while nothing actually succeeds. Or the event might still have to waitbehind three more asynchronous steps before it reaches the customer's inbox.Lag tells you about one queue. It says nothing about the pipeline as a whole.

Key takeaway #1

Lag measures backlog, not experience: Consumer lag onlytells you how big the backlog is at one hop. It says nothing about what yourusers actually experience.

Key takeaway #2

Track end-to-end freshness: What really matters inan asynchronous pipeline is how long it takes for an event to show up as anobservable effect. That's the SLI to track.

Key takeaway #3

Redefine your error budget: In an async flow, theerror budget isn't an uptime percentage. It's the share of events allowed tomiss a freshness threshold over a given period, including events that neverarrive at all.

If Consumer Lag Is Not an SLI, Then What Is It?

Every team that runs Kafka ends up putting consumer lag on a dashboardand treating it as enough. It's the simplest number available: the count ofmessages that haven't been processed yet. But lag only answers a throughputquestion: is the consumer group keeping up with what's being produced to thetopic? It doesn't answer the question the business actually cares about: howlong does it take, from the moment an event occurs, for the system to finishresponding?

Those are different questions, and incidents hide in the gap betweenthem. A system with zero lag can still fail its users. It might commit offsetsbefore processing and lose messages when it crashes. It might route everyfailing message to a retry or dead-letter topic, so the main topic clearscleanly while nothing actually succeeds. Or the event might still have to waitbehind three more asynchronous steps before it reaches the customer's inbox.Lag tells you about one queue. It says nothing about the pipeline as a whole.

Key takeaway #1

Lag measures backlog, not experience: Consumer lag onlytells you how big the backlog is at one hop. It says nothing about what yourusers actually experience.

Key takeaway #2

Track end-to-end freshness: What really matters inan asynchronous pipeline is how long it takes for an event to show up as anobservable effect. That's the SLI to track.

Key takeaway #3

Redefine your error budget: In an async flow, theerror budget isn't an uptime percentage. It's the share of events allowed tomiss a freshness threshold over a given period, including events that neverarrive at all.

Why request/response SLOs don't transfer

Synchronous SLOs are built around a complete exchange: a request comesin, a response goes out, and you measure the success rate and p99 latency ofthat pair. An event-driven pipeline has no such pair. A single business event,such as an order being placed, might fan out to a producer, three consumergroups, two enrichment stages, and a notification service, each with its ownretry policy and its own Kafka topic in between. There's no single request tomeasure and, because of that fan-out, often no single 'last step' either.

What you can measure is the event itself: the time between the momentit's created and the moment a specific, user-visible effect is complete. Inthis case, that's the order confirmation being sent. That interval isfreshness, and you can measure it even when the pipeline is asynchronous. Whenan event fans out, define freshness for each terminal effect (the confirmationsent, the invoice issued, the stock reserved), each with its own SLI. If 'done'really means that every branch has finished, you'll need a join step thatrecords completion as soon as the last branch reports in.

Measuring freshness across hops

One way to do this is to set a CreatedAt timestamp at thesource and carry it in the payload or the message header through every hop.

 

C# (AI-generated sample, reviewed by Cymo)

//OrderPlacedEvent carries its origin timestamp

publicrecord OrderPlacedEvent(

  Guid OrderId,

  DateTimeOffset CreatedAt,

  string Tier,

  decimal Amount);

 

//Terminal effect for this SLI: order confirmed and notification sent

publicclass OrderConfirmationConsumer

{

  public const string MeterName ="Shop.OrderPipeline";

 

  private readonly Histogram<double>_freshness;

  private readonly INotificationSender_sender;

  private readonly TimeProvider _time;

 

  public OrderConfirmationConsumer(

      IMeterFactory meterFactory,

      INotificationSender sender,

      TimeProvider time)

  {

      var meter =meterFactory.Create(MeterName);

 

      _freshness =meter.CreateHistogram<double>(

         "order.pipeline.freshness",

          unit: "s",

          description: "Time fromOrderPlaced creation to confirmation sent",

          tags: null,

          advice: newInstrumentAdvice<double>

          {

              HistogramBucketBoundaries = [1,5, 15, 30, 60, 120, 300, 600]

          });

 

      _sender = sender;

      _time = time;

  }

 

  public async Task Handle(OrderPlacedEventevt, CancellationToken ct = default)

  {

      await _sender.SendConfirmationAsync(

          evt.OrderId, idempotencyKey:evt.OrderId.ToString(), ct);

 

      var elapsed = (_time.GetUtcNow() -evt.CreatedAt).TotalSeconds;

 

      _freshness.Record(elapsed, newKeyValuePair<string, object?>("order.tier", evt.Tier));

  }

}

 

C# (AI-generated sample, reviewed by Cymo)

builder.Services.AddOpenTelemetry()

  .WithMetrics(metrics => metrics

     .AddMeter(OrderConfirmationConsumer.MeterName)

     .AddView("order.pipeline.freshness", newExplicitBucketHistogramConfiguration

      {

          // The SLO threshold (90s) must be aboundary, or compliance is estimated, not counted

          Boundaries = [1, 5, 15, 30, 60, 90,120, 300, 600]

      })

      .AddOtlpExporter());

‍

Exported via OpenTelemetry, this histogram gives you what lag can't: adistribution of the actual elapsed time for each business event, broken down byany low-cardinality dimension you add, such as tier or region.

Setting the SLO and the error budget

Once freshness is a metric, the SLO takes the same shape as any other:pick a percentile and a threshold. For example: 99% of orders are confirmedwithin 90 seconds of being placed, measured over a rolling 28-day window.

What this replaces

Infrastructure-level telemetry, such as throughput, lag, error logs, andper-hop traces, can show you that a consumer's throughput dropped or that itslag spiked. It can't tell you whether that mattered to anyone. Only an outcomemetric like end-to-end freshness, combined with a usable error budget and apercentile you can present to the business, lets you move from 'the systemstayed up' to 'the system kept itspromises.'

 

Want to define SLIs and SLOs that reflectwhat your users actually experience? Don't hesitate to reach out.

Let's make your event-driven platformmeasurable.

‍

We value your privacy! We use cookies to enhance your browsing experience and analyse our traffic.
By clicking "Accept All", you consent to our use of cookies.
Dark blue outline of a cookie icon.