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.
