Observability
This page covers how Northwind Goods sees what its services are doing: one trace per customer action, the
calls in and out of shop-api and shop-worker, browser errors from shop-web, queue health, grouped
errors, alerts to the ops channel, and a pass or fail answer after each deploy. Each section links to the
reference page for the full detail.
The dashboard is mapped at /warp on shop-api and reached by the ops team at
https://ops.northwind.example/warp. SQL examples assume the default warp schema and
UseSnakeCaseNamingConvention().
Tracing (unified trace view)
In the shop. A customer says "I paid but never got a confirmation email". Support has the order id and
opens the AuthorisePayment job for it. From there they want the whole story on one screen: the browser's
POST /api/checkout, the shop-api call it hit, the jobs OrderPlaced fanned out to, and the PayFast and
Mailer calls those jobs made.
Wiring. Job tracing needs no setup: every job spawned from a handler shares its TraceId. The other
spans in the waterfall come from the rows the other features already write, so the trace view is as complete
as what you record: endpoint observability for shop-api, AddAdapters() for the
PayFast and Mailer clients, and client observability for shop-web. To also send
the spans to an external backend:
// shop-api and shop-worker
builder.Services.AddOpenTelemetry()
.WithTracing(t => t.AddSource(WarpTelemetry.ServiceName).AddOtlpExporter())
.WithMetrics(m => m.AddMeter(WarpTelemetry.ServiceName).AddOtlpExporter());
Test scenario.
- Given
shop-apihas endpoint observability withCheckoutControlleropted in,shop-workercalls PayFast and Mailer through adapters withAddAdapters(), andshop-webloads the client script. - When you place an order on
shop-web, then open theAuthorisePaymentjob on the dashboard and click View full trace. - Then
/trace/{traceId}shows the waterfall with one green client bar (POST /api/checkout), one slate server bar for the same route, blue bars forReserveStock,AuthorisePaymentandSendConfirmationEmail(each nested underOrderPlacedin the job graph below), and purple bars for the PayFast and Mailer calls inside their job bars. Make Mailer return 500 and the Mailer bar turns red. Covered by:TraceQueryTestsBase,TraceIntegrationTestsBase,TracePropagationIntegrationTestsBase,ActivityTraceTestsBase,TraceGraphDefaultTests.
Pitfall: a job whose logs have aged out under retention shows a — placeholder instead of a bar. Look at
traces while they are fresh.
Observability sinks
In the shop. The ops team runs Grafana and Tempo next to the Warp dashboard. They want checkout requests in both places, but the ShipIt tracking poll calls ShipIt thousands of times an hour and should not fill the database with call-log rows.
Wiring. Both sinks are set once per process, for everything of their kind in it.
AddEndpointObservability(o => o.Sink = …) (Database by default, Otel or Both) covers every observed
endpoint of that process, and AddAdapters(o => o.Sink = …) covers every adapter of that process. An Otel
adapter sink on shop-worker would also drop the PayFast and Mailer rows that the trace view and Issues
need. So shop-api sends its endpoints to both places, shop-worker keeps the default adapter sink, and the
ShipIt adapter alone turns down its volume:
// shop-api
builder.Services.AddWarp<ShopDbContext>(opt =>
{
opt.UsePostgreSql();
opt.AddEndpointObservability(o => o.Sink = RecordingSink.Both); // dashboard rows + span attributes
});
// shop-worker (the ShipIt tracking poller runs here): add one line to the existing "shipit"
// registration from Integrations. Do not call AddAdapter("shipit") a second time; a duplicate name throws.
opt.AddAdapter<IShipItApi>("shipit", a =>
{
// ... BaseUrl, GroupLabel, capture and rate limit as in Integrations ...
a.Recording.RecordCalls = CallRecording.FailuresOnly; // rows for failed ShipIt calls only
});
The shipit registration is in Integrations. AddAdapters() there keeps
the default Database sink for every adapter in shop-worker: PayFast, Mailer and ShipIt alike.
Test scenario.
- Given the wiring above and an OTLP collector receiving the
Warpsource. - When a checkout runs and the ShipIt tracking job polls a parcel.
- Then the checkout request has a row on the dashboard's Endpoints page and its ASP.NET request span
in Tempo carries
warp.endpoint.*attributes. The ShipIt call has aClientspan in Tempo, andSELECT count(*) FROM warp.adapter_call_log WHERE adapter_name = 'shipit'does not grow while the calls succeed. Thewarp.adapter.callsmeter and the ShipIt call count on the Adapters page still count every call. Make ShipIt return 503 and the failed calls get rows. PayFast and Mailer calls keep a row each. Covered by:RecordingSinkWiringTests,SpanEnrichmentTests,OTelAggregateMetricsTests,OTelJobMetricsSinkTestsBase,AdapterRecorderTestsBase.
Pitfall: an Otel-only endpoint sink writes no rows, so it produces no Issues. Keep shop-api on Both if you
want checkout 500s to become Issues. The same holds for adapters: an Otel adapter sink would stop Issues for
every adapter in that process.
Endpoint observability
In the shop. Checkout is an ordinary ASP.NET CheckoutController, not a Warp HTTP endpoint. When it
returns 500s, the team wants them on the Endpoints page and as Issues, with the request that caused them.
The order-status polling action is called every few seconds by the SPA and should stay out.
Wiring. Register the recorder, install the middleware after UseRouting, and opt the controllers in.
WithWarpObservability() on the route builder, or [WarpObserved] (namespace Warp.Http.Observability) on a
controller or action. [ExcludeFromWarpObservability] (namespace Warp.Core.Endpoints) always wins.
// shop-api: Program.cs
builder.Services.AddWarp<ShopDbContext>(opt =>
{
opt.UsePostgreSql();
opt.AddEndpointObservability(o =>
{
o.CaptureRequestBodies = CaptureMode.None; // checkout bodies carry customer data
o.CaptureResponseBodies = CaptureMode.OnFailure;
});
});
var app = builder.Build();
app.UseRouting();
app.UseWarpHttpObservability(); // after UseRouting
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers(); // only the opted-in controllers below are observed
// CheckoutController.cs
[WarpObserved]
[ApiController]
[Route("api/checkout")]
public class CheckoutController : ControllerBase { /* ... */ }
// OrdersController.cs
[WarpObserved]
[ApiController]
[Route("api/orders")]
public class OrdersController : ControllerBase
{
[ExcludeFromWarpObservability]
[HttpGet("{id}/status")]
public IActionResult PollStatus(Guid id) { /* ... */ }
}
To observe every controller instead, use app.MapControllers().WithWarpObservability();.
Test scenario.
- Given the wiring above, and a temporary line in
CheckoutControllerthat throwsInvalidOperationExceptionwhen the cart contains SKUTEST-500. - When you check out a cart with
TEST-500three times, and pollGET /api/orders/{id}/statusa few times. - Then the Endpoints page lists
POST /api/checkoutwith 3 failed calls and a non-zero error rate. The call detail page of a failed call shows the status 500 and the exception type. It has no Related jobs section, because the failed calls spawned no jobs and the section is left out when it is empty.GET /api/orders/{id}/statusdoes not appear. Within about a minute Issues shows one Endpoint issue,InvalidOperationExceptiononPOST /api/checkout, with count 3. Covered by:HostEndpointObservabilityTestsBase,WarpEndpointIdentityFactoryTests,HostEndpointPipelineOrderTests,EndpointMiddlewareTests,EndpointFlusherTestsBase.
Pitfall: the middleware must go after UseRouting(). Placed before an explicit UseRouting() it silently
observes nothing.
Client observability
In the shop. shop-web is a single-page app. A broken cart script or a slow product page never reaches
the server logs. The team wants JavaScript errors and Core Web Vitals in the same dashboard, attributed to
shop-web, and linked to the server calls they made.
Wiring. shop-api hosts the ingest endpoint, and the SPA loads the shipped script:
// shop-api
builder.Services.AddWarp<ShopDbContext>(opt =>
{
opt.UsePostgreSql();
opt.AddClientObservability(o =>
{
o.AddIngestKey("shop-web", "pk_live_northwind_web"); // public, write-only
o.AllowedOrigins.Add("https://shop.northwind.example");
});
});
var app = builder.Build();
app.UseRouting();
app.MapWarpClientObservability(); // POST /warp/ingest + GET /warp/ingest/client.js
<script src="https://shop.northwind.example/warp/ingest/client.js"
data-key="pk_live_northwind_web"
data-release="1.4.2"></script>
Test scenario.
- Given the wiring above and the script on every
shop-webpage. - When you open the storefront, browse two product pages, and run
setTimeout(() => { throw new Error('cart test 42') })in the browser console. Then runwindow.warp.track('cart.opened', { items: 3 }). - Then the Client page for
shop-webshows the error in the event stream, the customcart.openedevent, and LCP / CLS / INP p75 tiles after the page hides. The error's detail has a stack and breadcrumbs. The session timeline lists the API requests of that visit with links to/trace/{traceId}. Issues gets one Client issue whose title is the normalized message. It keeps the browser's prefix, so in Chrome it readsUncaught Error: cart test <num>. Covered by:ClientIngestEndpointTests,ClientEventFlusherTestsBase,ClientEventQueryTestsBase,ClientEventKeysTests,ClientEventRecorderTests,ClientIngestMeterTests,ClientEventCleanupTestsBase.
Pitfall: the ingest key is public by design. It only authorises writes. Never send customer ids or emails in
track() properties; consent for behavioural data is the shop's responsibility.
Queue metrics
In the shop. Payment captures (CapturePayment, see Reliability) run on their own
payments queue in shop-worker. An order stuck in "capturing payment" is a queue that is not drained. The team wants to see how long payment jobs wait before a worker
picks them up, and how deep the queue is.
Wiring. Queue-wait and backlog are always on. Put the work on its own queue and serve it with a worker group. A queue-wait SLO turns the signal into an objective (see Metrics and SLOs):
// shop-worker, when an order ships: capture on the payments queue
await publisher.Enqueue(new CapturePayment { OrderId = order.Id }, "payments");
// shop-worker
builder.Services.AddWarpServer<ShopDbContext>(opt =>
{
opt.UsePostgreSql();
opt.AddWorkerGroup(g =>
{
g.Queues = ["payments"];
g.WorkerCount = 4;
});
opt.AddSlo(o => o.AddObjective(
SloKind.QueueWaitLatency, "payments", target: 30_000, percentile: 95,
application: "shop-worker", name: "Payments queue wait p95 < 30 s"));
});
shop-worker also calls AddSlo for the metric objectives on Metrics and SLOs.
Repeated AddSlo calls merge, so both sets are seeded. One combined call is easier to read; the guide splits
it only to keep each objective next to its feature.
The objective is scoped to shop-worker so that it counts in shop-worker's
post-deploy verdict and not in shop-api's. A queue-wait objective reads the queue's
global wait whatever its application, so the scope changes only which verdicts it counts in.
Test scenario.
- Given
shop-workerrunning with thepaymentsgroup. - When you pause the
shop-workerserver from the Applications page, ship 10 orders, wait two minutes, and resume it. - Then while paused, the Queues family on the Counters page shows the
paymentsrow with backlog depth 10 and an oldest age that grows with each sample (60 s cadence). After resume, depth returns to 0. On a fresh test database the queue-wait average forpaymentsreads around two minutes, and p95 and p99 read5.0m: percentiles are bucket upper bounds, and a two-minute wait falls in the 60 s to 300 s bucket. The average and both percentiles are lifetime aggregates, so on a database with earlier traffic they move less. The SLO above reads Breaching on the SLOs page.GET /warp/api/queues/metricsreturns the same numbers in milliseconds (300000for p95 and p99). Covered by:QueueWaitClaimTestsBase,BacklogSamplerTestsBase,QueueMetricsQueryTestsBase,QueueWaitKeysTests,SloEvaluatorTestsBase.
Pitfall: backlog is queue-global, not per application. Queue-wait per application has no histogram, so its p95 / p99 read 0; use the global row for percentiles.
Error grouping (Issues)
In the shop. When PayFast is slow, AuthorisePayment throws PayFastTimeoutException hundreds of times,
each with a different order id in the message. The team wants one issue, not hundreds of rows, with the
version that introduced it and a link to one failing trace.
Wiring. Issues are always on. Every failed job, observed 5xx/4xx, failed adapter call and browser error feeds
them. ApplicationVersion makes first-seen / last-seen versions useful:
// shop-worker
builder.Services.AddWarpServer<ShopDbContext>(opt =>
{
opt.UsePostgreSql();
opt.ApplicationName = "shop-worker";
opt.ApplicationVersion = builder.Configuration["Build:Version"]; // set by CI
opt.ApplicationEnvironment = "production";
});
Test scenario.
- Given a test PayFast sandbox that times out for card number
4000 0000 0000 0119. - When you place three orders with that card.
- Then within about a minute Issues shows one Job issue
PayFastTimeoutException: Payment <num> timed outwith culpritAuthorisePayment, count 3 or more (retries count too), and first-seen version equal to the deployed build. Resolve it, place one more failing order, and the issue re-opens with a "regressed" badge; anIssueRegressedevent reaches any registered notifier. Covered by:ErrorFingerprintTests,ErrorGroupAggregatorTestsBase,ErrorGroupSingleWorkerIntegrationTestsBase,ErrorGroupDispatcherIntegrationTestsBase,ErrorGroupCommandTestsBase,ErrorGroupQueryTestsBase,ErrorGroupCleanupTestsBase.
Pitfall: the issue title is normalized, but the raw sample is not. Never put a PAN or an email in an exception message (§1.2).
Operational notifications
In the shop. The ops Slack channel should hear about the things nobody watches a dashboard for: a
shop-api instance that disappeared, an SLO that started breaching, a webhook to a marketplace partner that
gave up.
Wiring. Implement IWarpNotifier and register it on shop-worker, the process that runs the server tasks
raising InstanceDown and SloBreached:
public sealed class OpsSlackNotifier : IWarpNotifier
{
private readonly IHttpClientFactory _httpClientFactory;
public OpsSlackNotifier(IHttpClientFactory httpClientFactory) => _httpClientFactory = httpClientFactory;
public async Task NotifyAsync(WarpOperationalEvent evt, CancellationToken ct)
{
var text = evt switch
{
InstanceDownEvent x => $"{(x.IsServer ? "Server" : "Instance")} of {x.ApplicationName} went down",
SloBreachedEvent x => $"SLO '{x.Name}' breaching, budget left {x.BudgetRemaining:P0}",
WebhookDeliveryExhaustedEvent x => $"Webhook {x.EventType} to {x.GroupName ?? x.Url} gave up",
_ => evt.Message,
};
using var client = _httpClientFactory.CreateClient("ops-slack");
await client.PostAsJsonAsync(string.Empty, new { text }, ct);
}
}
// shop-worker
opt.AddNotifier<OpsSlackNotifier>();
Test scenario.
- Given the notifier registered on
shop-workerand pointed at a test Slack channel. - When you kill one
shop-apiinstance withkill -9(no graceful stop). - Then about two minutes later (
ApplicationInstanceStaleGrace) the channel gets "Instance of shop-api went down". The Applications page shows the instance gone and aStaleSweptlifecycle entry. Repeat the queue metrics pause test and the channel gets one "SLO 'Payments queue wait p95 < 30 s' breaching" message, once per healthy-to-breaching edge. Covered by:WarpNotifierDispatcherTests,NotifierDispatchTestsBase,NotifierPostCommitIntegrationTestsBase,SloEvaluatorTestsBase.
Pitfall: notifications are not persisted. A crash between commit and dispatch, or Slack being down, drops the
alert. Notifiers are singletons: inject IServiceScopeFactory, never ShopDbContext.
Applications and deploys
In the shop. shop-api runs three replicas and shop-worker two. The team wants one roster of every
process, alive or dead, and a record of each release: when shop-api 1.4.2 reached production and what it
replaced.
Wiring. Set the name and the CI build version on each service. A deploy is recorded the first time an instance registers with a version not seen before for that application and environment:
// shop-api (AddWarp) and shop-worker (AddWarpServer) alike
opt.ApplicationName = "shop-api"; // "shop-worker" in the worker
opt.ApplicationVersion = builder.Configuration["Build:Version"]; // CI sets Build__Version=1.4.2
opt.ApplicationEnvironment = "production";
Test scenario.
- Given
shop-api1.4.1 running in production. - When you roll out 1.4.2 with three replicas starting at the same time.
- Then Applications > shop-api lists three live instances on 1.4.2 and the Deploys card shows one
entry
1.4.1 → 1.4.2.SELECT count(*) FROM warp.application_deploy WHERE application = 'shop-api' AND version = '1.4.2'returns 1. Rolling back to 1.4.1 adds no row. On a metric's detail page the deploy appears as a dashed marker. Withshop-apiselected as the application it is labelled1.4.2; with no application selected it is labelledshop-api 1.4.2. Covered by:ApplicationDeployTestsBase,ApplicationRegistryTestsBase,ApplicationQueryTestsBase; UI:deployModel.test.ts,metricModel.test.ts.
Pitfall: without both ApplicationName and a non-blank ApplicationVersion, no deploy is recorded and the
verdict below returns 404.
Post-deploy verdict
In the shop. After CI rolls out shop-api, the pipeline should judge at least ten minutes of traffic and
fail the release if checkout breaks. The answer comes from the health board
tiles and SLOs scoped to shop-api (or to no application).
Wiring. No registration: the route is served by any AddWarp process with the dashboard, behind the
dashboard's authorization. A CI step after the deploy:
curl -fsS -H "Authorization: Bearer $WARP_CI_TOKEN" --get \
"https://ops.northwind.example/warp/api/applications/verdict" \
--data-urlencode "application=shop-api" \
--data-urlencode "version=$GIT_TAG" \
--data-urlencode "environment=production" \
--data-urlencode "minWindowMinutes=10" \
--data-urlencode "minCoverage=0.5" | jq '{verdict, summary, checksWithData, checksTotal, settlesAt: .window.settlesAt}'
Poll while verdict is pending, fail the job on fail. Board tiles are judged over complete 5-minute
buckets that start after the deploy only; the bucket the deploy fell into is never counted. SLO checks report
each objective's current state over its own rolling window, which reaches back before the deploy; an SLO last
evaluated before the window starts reads no data. A deploy stays pending until
minWindowMinutes of that clean data exists and is complete, which adds the bucket close plus about 30 s
(MetricFlushInterval). With minWindowMinutes=10 the verdict settles 10.5 minutes after a deploy that
lands exactly on a bucket boundary and up to just under 15.5 minutes after one that lands later in a bucket
(5.5 to just under 10.5 minutes at the default of 5). A value that is not a multiple of 5 rounds up to whole
buckets, so 7 waits for 10 minutes of clean data. window.settlesAt says when, and window.to is the
board's complete-data cut, not "now". minCoverage=0.5 turns a pass that rests on fewer than half of the checks
into noData, so a quiet first window (no checkouts yet) does not read as healthy; the summary line starts
with the count, e.g. pass (3 of 6 checks had data): 3 healthy, 3 no data.
The full script is in
Calling it from CI.
Test scenario.
- Given the board tiles scoped to
shop-api("Checkout success", "Checkout 5xx", "PayFast callbacks") and the SLOs scoped toshop-api("Checkout success", "Checkout: no 5xx", "Checkouts vs last week") from Metrics and SLOs: six checks. The "Partner webhooks delivered" tile and the "PayFast authorise p95 < 2 s", "Stockroom sync lag" and "Payments queue wait p95 < 30 s" SLOs are scoped toshop-worker, so they count inshop-worker's verdict, not in this one. - When you deploy a build of
shop-apithat throws on every checkout with SKUTEST-500, send 10 such checkouts between minute 6 and minute 10 (after the deploy's own bucket has closed, so they count), and call the route at minute 2 and again at about minute 16. - Then the first call returns
"verdict": "pending"withwindow.settled: false. The second returns"verdict": "fail",deploy.previousVersionset to the old version, achecksentry for the "Checkout 5xx" tile with"state": "breaching"(more than its limit of 5), and one for the "Checkout: no 5xx" SLO, also breaching. With an active acknowledged-noise annotation that covers the tile (no filter, or the tile's own filter or a wider one), the tile's check reads"state": "acknowledged". The verdict is stillfail, because the "Checkout: no 5xx" SLO still breaches: annotations never acknowledge an SLO. A version that never registered returns 404. If you deploy again at minute 1, the earlier build is never leftpending: asked by its version, it is settled at the second deploy. Its window holds no complete bucket after the deploy, so it returns"verdict": "noData"with"checks": []andchecksTotal: 0, and the summary says it was superseded before a complete metric bucket. Covered by:DeployVerdictTestsBase,DeployVerdictMathTests,DeployVerdictQueryTests; UI:verdictModel.test.ts.
Pitfall: unscoped board tiles and SLOs count in every application's verdict, and a check scoped to another
application never counts. On the shared database, scope the checkout tiles to shop-api, or a shop-worker
deploy fails on a checkout problem.