Skip to content

ADR: Observability

ADR: Observability, the Admin tab

Status: roughed in 2026-09-01, the evening it was asked for. A polish pass is planned for the Thursday build day; this records the shape and the reasoning so the rough-in is a decision, not an accident.

In plain words

The site has a public Admin tab that shows its own condition: the health checks with how long each took, and what Azure reports about the running container. A third card lists recent server errors, kept in memory and cleared on each deploy.

What that is worth: a developer sees a slow check or a restart without opening the Azure portal, and the organization can show that the site reads its own state but can change nothing (Reader scope).

Context

The site could report its version but not its condition. The ask, verbatim: health checks and errors, viewable from the website like an admin tab, reaching through Azure.

Decision

An Admin tab in the header, a real screen with three cards that fetch and fail independently:

  • Application health. Hand-rolled probes behind /healthz (liveness), /readyz (readiness), and /api/health (structured JSON: overall status, each probe, uptime, version, commit). The container healthcheck now hits /healthz. The framework health-check library is the planned upgrade; the hand-rolled version shipped the same evening it was asked for.
  • Azure's view of the container. The container group runs as a user-assigned identity, that identity now holds Reader on its own resource group, and the API trades the identity for a management-plane token and reads its own container group: group state, container state, restart count, and the image Azure believes it is running. Cached 60 seconds. Anywhere the identity endpoint does not exist, local dev included, the card degrades to app-level health and says so.
  • Recent server errors. Middleware records unhandled exceptions and 5xx responses into a fixed 50-entry in-memory buffer served at /api/errors. No stack traces are exposed. The buffer resets on every deploy and the screen says that plainly.

The tab is public, no login. On this site the observability is the exhibit, the same reasoning that serves the Bicep file from a menu. A real product gates this behind authentication and ships errors to a persistent sink; both are documented here and deliberately not built, the same pattern as the undeployed production design.

Consequences

  • The client id and resource path baked in as defaults are identifiers, not secrets; a token for them can only be minted from inside the container itself.
  • Reader scope means the site can see itself but change nothing.
  • The error buffer is honest about its limits, which is the demo working as intended: the limits are part of the story.

Addendum, 2026-09-02: second pass, shipped as 1.0.0.17

After the first pass, Steve said he liked a screen where the health checks are easy to see. The second pass makes the screen say more without saying it louder.

  • Every health check reports its duration. Each probe is timed with a stopwatch and the Admin tab prints the milliseconds beside the check in the muted style, so a slow disk or a slow lookup is visible before it turns into a failure. The readiness endpoint uses the same probes and is unchanged.
  • Azure's card lists the container's recent events. The management read already returned the container's instance view; the card now shows its last three events, newest first, with the name, how many times it happened, when it last happened, and the message trimmed to a line. A restart story (pulled, started, killed, started again) reads from the tab without opening the portal. Unavailable degrades exactly as before.
  • The sweep. Five comments in Program.cs carried a double-encoded em dash, and one of them a mangled "resume", from an encoding-blind edit on the first day; they are plain ASCII now, changed byte by byte with everything else in the file untouched.

The samples below are read from this build's source each time the page is served (ADR: Live code samples). The timed checks (api/TheYard.Api/Features/Health/HealthEndpoints.cs):

// Each probe is timed and each answer is a value, never an exception: a
// health endpoint that throws tells an orchestrator nothing. The checks are
// deliberately about the files this app cannot run without.
/// <param name="paths">Where the files this site cannot run without are.</param>
/// <param name="backends">The stores this container runs.</param>
/// <param name="cancellation">The request's, handed to each store's probe and to nothing else; the file checks do not wait.</param>
/// <param name="readinessOnly">True to run only the checks that gate readiness, which leaves the store alone.</param>
private static async Task<HealthCheckEntry[]> RunChecksAsync(HostPaths paths, Backends backends, CancellationToken cancellation, bool readinessOnly = false)
{
    // Each probe is timed: the Admin tab shows the milliseconds beside the check,
    // so a slow disk or a slow lookup shows up before it fails (ADR-010, second pass).
    // Awaited, because the document store's probe is two point reads over the
    // network and a health check that blocked a thread on them would be the
    // defect the ports record describes (ADR: The ports learn to wait).
    async Task<HealthCheckEntry> Check(string name, Func<CancellationToken, Task<bool>> probe, string detail, bool gatesReadiness = true)
    {
        if (readinessOnly && !gatesReadiness)
        {
            // Not asked, so not run. The caller filters these out anyway; this
            // is what stops the probe behind them from happening at all.
            return new HealthCheckEntry(name, "pass", "not asked", 0, gatesReadiness);
        }

        var clock = Stopwatch.StartNew();
        try { return new HealthCheckEntry(name, await probe(cancellation) ? "pass" : "fail", detail, clock.ElapsedMilliseconds, gatesReadiness); }
        catch (Exception ex) { return new HealthCheckEntry(name, "fail", ex.GetType().Name, clock.ElapsedMilliseconds, gatesReadiness); }
    }
    var checks = new List<HealthCheckEntry>
    {
        await Check("dataset file", _ => Task.FromResult(File.Exists(paths.DataPath)), "data/vehicles.json present"),
        await Check("docs", _ => Task.FromResult(File.Exists(Path.Combine(paths.RepoRoot, "docs", "hosting", "HOSTING.md"))), "served documents findable"),
        await Check("photo manifest", _ => Task.FromResult(File.Exists(paths.ManifestPath)), "image manifest present"),
        // The process listens before its catalogue is in (Startup.cs, listen-first),
        // so ready means the default store's catalogue has loaded: the thing a
        // deploy, and a blue-green swap, must wait for before sending a visitor.
        await Check("catalogue", _ => Task.FromResult(backends.Default.CatalogueLoaded), "the default store's catalogue is loaded"),
    };
    // One check per store, named by the store, so a container running both
    // says which one is unavailable. The default store's check is called
    // "database", because the deploy's Verify step and the Admin tab's card both
    // read that name.
    foreach (var backend in backends.All)
    {
        checks.Add(await Check(
            ReferenceEquals(backend, backends.Default) ? "database" : $"database ({backend.Key})",
            backend.Probe,
            // The reason is in the log, not in this response. A health endpoint
            // is public on purpose, and an exception message from a storage
            // failure is typically a filesystem path: exactly the map of the
            // inside of the process that ProblemHandler refuses to draw.
            backend.Database.Ready
                ? $"the seed catalogue is in the store ({backend.Name})"
                : $"{backend.Name} is unavailable, serving the catalogue from files; "
                    + "the reason is in the log",
            // The one check that does not gate readiness, which is the whole
            // point of the fallback. A container with no database still serves
            // the catalogue, the filters, the photos and the bidding; the only
            // thing it loses is bids outliving the process. Reporting itself
            // not ready would take a working site out of service: the deploy's
            // `curl -fsS /readyz` would fail against a site serving every
            // vehicle perfectly well.
            gatesReadiness: false));
    }
    return checks.ToArray();
}

Live from api/TheYard.Api/Features/Health/HealthEndpoints.cs, region health-checks, read from this build at 99df7a8.

The events, read from the same management response (the observability types moved to api/TheYard.Api/Shared/Observability/Observability.cs in ADR: The staff review):

// The last three events Azure recorded for the container (pulls, starts,
// kills), newest first, each message trimmed: enough to read a restart
// story from the Admin tab without opening the portal (ADR-010, second pass).
if (civ.TryGetProperty("events", out var evs) && evs.ValueKind == JsonValueKind.Array)
{
    events = evs.EnumerateArray()
        .Select(e => new
        {
            name = e.TryGetProperty("name", out var n) ? n.GetString() ?? "" : "",
            count = e.TryGetProperty("count", out var c) && c.TryGetInt32(out int ci) ? ci : 1,
            last_at = e.TryGetProperty("lastTimestamp", out var lt) ? lt.GetString() ?? "" : "",
            message = Trim(e.TryGetProperty("message", out var msg) ? msg.GetString() ?? "" : "", 140),
        })
        .OrderByDescending(e => e.last_at, StringComparer.Ordinal)
        .Take(3)
        .Cast<object>()
        .ToList();
}

Live from api/TheYard.Api/Shared/Observability/Observability.cs, region azure-events, read from this build at 99df7a8.

The proof is one API test that every check carries a non-negative duration and two end-to-end checks that the Admin tab prints it, on a laptop and on a phone, in api/TheYard.Tests/AdminEndpointTests.cs, tests/e2e/admin.spec.ts and tests/e2e/mobile.spec.ts. The events list is proven by the live site, since only the container on Azure can ask about itself.

Where it sits

Everything this record built lives in the host Api and the front end: the probes in Endpoints/HealthEndpoints.cs, the ErrorRingBuffer and the AzureSelf reader in Observability.cs, and the cards under src/components/admin. Each card fetches and fails on its own, so one broken reading never blanks the tab. No port was needed because the container reads its own memory and its own Azure resource, and the price is an error buffer that empties on every deploy. Errors that must survive a roll are the reason to choose differently, and that is the job ILogStore, an Application port, now does for logs that outlive the container.

Files

The look, from the live site

The Admin tab at 1.0.0.22: three passing health checks with their durations, Azure reporting the container group Running with its last three events, and no server errors recorded

The health card, from the fetch to the rows (src/components/admin/HealthCard/HealthCard.tsx, a chunk of its own since the workbench):

<article className={`${styles.card} op-glass`} data-testid="health-card">
  <h2 className={styles.cardTitle}>Application health</h2>
  <Range of="keptWarm" />
  {health === null ? (
    <CardState state="loading" />
  ) : health === 'failed' ? (
    failed('the health report')
  ) : (
    <>
      <p className={styles.statusRow}>
        <span className={pill(health.status === 'healthy')}>{health.status}</span>
        <span className={styles.muted}>
          v{health.version} · {health.commit} · up {formatUptime(health.uptime_seconds)}
        </span>
      </p>
      <ul className={styles.checkList}>
        {health.checks.map((check) => (
          <li key={check.name} className={styles.healthRow}>
            <span className={pill(check.status === 'pass')}>{check.status}</span>
            <span>{check.name}</span>
            <span className={styles.muted}>{check.detail}</span>
            <span className={styles.duration} data-testid="check-duration">
              {check.duration_ms} ms
            </span>
          </li>
        ))}
      </ul>
      {/* The keep-warm loop's last pass (ADR: Kept awake). */}
      <p className={styles.muted} data-testid="kept-warm">
        {keptWarmLine(health.kept_warm)}
      </p>
    </>
  )}
</article>

Live from src/components/admin/HealthCard/HealthCard.tsx, region health-card, read from this build at 99df7a8.

Addendum, 2026-10-07 (1.0.3.89): ready means the catalogue is in

The process listens before its catalogue loads (ADR: The ports learn to wait, the addendum on listening first), so /readyz gained one check that gates it, catalogue, which passes once the default store's hundred thousand vehicles are in memory. /healthz still answers the moment the process is up. /api/health shows the new check beside the others, and since it is an API read it waits for the load like every other, so the Admin tab sees the check pass; it is /readyz that says 503 while a fresh container loads. The deploy waits on /readyz before it reads the filters, and a blue-green swap will wait on the same thing.

Addendum, 2026-10-29: the error ring has its own file, and the Azure read takes a token

Two changes, both forced by a rung rather than chosen for this record's own reasons.

Observability.cs was 294 lines, four inside the three-hundred cap, and the cancellation rung needed three parameters in it. A split made under the pressure of an unrelated change is made by the alphabet instead of by job, so it was made first and by job: ErrorEntry, StackFrames and ErrorRingBuffer are now api/TheYard.Api/Shared/Observability/ErrorRing.cs, which changes when what is recorded about a failure changes. Observability.cs keeps its name, the health probe's outcome, the site asking Azure about itself, and an index of its parts. The azure-events region a live sample on this page reads was left where it is.

AzureSelf.GetStateAsync takes the cancellation of the poll that asked and carries it to the token exchange and to all three reads, so a card the Admin tab has stopped drawing stops asking Azure about this web app. It caches for sixty seconds either way, so the saving is a connection and not a read.

Addendum, 2026-11-11 (1.0.5.24): the Azure card's view is kept built

What stopped being true: the addendum of 2026-10-29 says AzureSelf caches for sixty seconds. A 48-hour probe read /api/admin/azure at a cold p95 of 4.3 to 4.5 s, the token and the three reads made on the request each time the minute lapsed. From this version the card's view is kept the way the Cloud cards' are (ADR-102, the addendum of this version): under two minutes old it answers at once, past one minute the next is read behind the request, and one keeper reads it again each minute while somebody has asked in the last hour. A read Azure refuses is answered as available false and never kept, so a refusal never replaces a view the card already has. The poll's cancellation now stops only a read the request waits on.

Correction, 1.0.5.25: the paragraph above says the poll's cancellation stops a read the request waits on. From this version a request's cancellation ends only its own wait: the read goes on under two minutes and the host's stopping, other requests and the keeper share it, and its view is kept for the next request (ADR-102, the addendum of this version).

Enforced by

Not machine-checked. Held by review.

Store

The Yard, home

Steven StoutStaff .NET engineerRemote

Production .NET that stays up. Built with AI, measured on every version.

Steven Stout

Hi, I'm Steve. I build the systems that make delivery boring in the best way, then coach people inside them.

  • 200+

    production releases, none took the platform down

    Conway Investment Research, 2019 to 2024. Sole engineer for the first three years on a live financial advisory platform.

    See how
  • 50%

    shorter release cycle

    Storee Construction, 2024 to 2026. Four ASP.NET applications onto one .NET 10 platform on Azure, with a four-person team I hired and mentored.

    See how

01Verified

Steven Stout

A real person, and the work is mine.

  • Identity

    Checked by LinkedIn, not by me.

    LinkedIn verified my government ID.

  • Running system

    You are looking at it.

    Version 1.0.5.273 is live. Nothing ships unless it passes the automated gates first.

That's who I am. Here's how I work.

02Strengths

Ten strengths, each with the proof beside it. The numbers match my resume and LinkedIn, and the live ones are read from this site as you look.

  • 01

    Keeps production alive

    200+ releases on a live financial platform, and none took it down. Sole engineer for the first three years.

    See the Conway work

  • 02

    Simplifies messy systems

    Four ASP.NET applications onto one .NET 10 platform on Azure, and a release cycle 50% shorter.

    See the Storee work

  • 03

    Marries dev and infrastructure

    Blue-green releases at Storee that flipped in about 5 seconds with nobody signed out, and Azure Front Door at two employers.

    See this site's cloud

  • 04

    Designs data that holds up

    White-label clients on one shared database, the isolation built into the data, and no cross-client issues.

    See the Conway work

  • 05

    Keeps AI-written code honest

    15 quality numbers that may only improve: 273 releases in a row with none worse.

    See the quality numbers

  • 06

    Resourceful

    $30,000+ cut from Azure and vendor spend at Conway. This site's Azure bill is public, resource by resource.

    See the bill

  • 07

    Builds people up

    Hired and mentored a four-person team. 13 colleagues recommend me by name.

    Read the recommendations

  • 08

    Takes ideas to production

    This site: designed, built and run solo, with 352 versions measured through one gate.

    How it was built

  • 09

    Writes clearly

    Posts on real engineering problems, in plain words.

    Read the blog

  • 10

    Owns decisions

    153 decision records, each with its tradeoff and the call I made.

    See the decision records

Built with AI. Gated so quality never slides.

Steven Stout’s showcase: a used-vehicle auction on .NET and React, built and run by one engineer, live on Azure, with its decisions written down.

No quality number has gotten worse at any release since 1.0.5.1 on 10 November: 273 releases in a row.

One engineer, an AI agent and a gate that checks 15 quality numbers on every release. 352 versions measured, with every result public, the worst days included.

82 releases in the last 7 days, each through the same gate.

Async methods with no CancellationToken, may only fall

11091.0.3.1391.0.5.2731.0.4.115, the ratchet
Every number, on the Quality page

TheYard, right nowLive

Answering in

unread

02505007501,000

server time at p95, the usual five minutes of the last day.

Azure this month

unread

the bill, by resource, read from Azure. The Admin tab shows every line.

Since the last roll

unread

 

rolled in place by the pipeline, behind one gate.

People who have visited

unread

30 days agotoday

Scanners, my own tools' and my own reads left out.

03Start here

04Where teams are heading

How I see engineering with AI, and the setup on this site that backs it.

AI-augmented teams · Architecture and ownership

AI writes more of the code. Someone still has to own what ships.

Teams are going to be heavily AI-augmented. That moves the senior job toward architecture and technical ownership: deciding what to build in pieces small enough to verify, and owning what ships.

  • Task tracking will get automated too. Judgment stays human: seeing a design fail at scale before it does.
  • On this site the AI's first design held the whole catalogue in memory. I caught it when the App Service plan hit 82 per cent and moved the work to the store.

What the AI wrote, what I decided

07Tech stack

  •    
  •    
  •    

Read from the build, never typed by hand

What TheYard runs on

What we use, where it runs, its AWS twin, the version as built, and the file that proves it.

Cloud patterns, not one vendor: every Azure piece in this stack has a named AWS twin. Mapped, not yet run on AWS.

  • .NET 1114 projects
  • React 19.3TypeScript 7.0
  • Azure9 Bicep files
  • 11GitHub Actions workflows
The whole stack, with the file that proves each line

The last release the gate stopped was 1.0.5.258 on 2 December, at its browser 1 of 2 job.

08How it is built

09How it is run

10Who and why

Next step

11What has to work, where is it today, and what does success look like?

Book 20 minutes opens an email to me with those three questions in it, and I answer with a time.

Book 20 minutes

Your email app should have opened with this message. If it did not, copy it and send it from any mailbox.

Or message me on LinkedIn