A computational report, in one page
Python cleans a committed dataset, draws the charts and fits the model as the page builds; every figure and table is numbered and cross-referenced.
The chart and the coefficient table were produced by the Python cells you can read on this page, running against a committed CSV while the page was being built, and the prose around them reports what they show. Change one cell in the source and only that cell and whatever depends on it runs again.
data/latency.csv is a synthetic quarter of queue telemetry: thirteen ISO weeks, three
regions, two release channels, 78 rows, written from a fixed seed so that anyone who
clones the repository re-runs this page and gets these numbers back. The generating
process has a gentle downward drift in it, a canary penalty that decays to nothing, and
a storage incident in ap-south in week 33. The analysis below looks for all three.
# Taliesin renders every inline matplotlib figure TWICE, once with the light theme's
# foreground and once with the dark theme's, and the page swaps them when the reader
# toggles the theme, so `INK` below is only the fallback for anything the recolour does
# not reach. Data colours are never touched, so those DO have to read on both themes:
# three mid-chroma hues, no near-white and no near-black.
=
=
= 33
=
=
= &
=
How the tail moved
, =
=
Outside the incident, eu-west and us-east clear the 150 ms objective every week, and ap-south crosses it only in the early weeks, mostly on the canary channel. The quarter trends gently downward: that is the caching work that landed in week 27. The canary penalty is the other visible pattern. Early on the dashed lines sit well above their solid counterparts, and by week 39 they have converged.
Here is the same frame summarised by hand, typed into the source as an ordinary markdown table rather than displayed by a cell:
| Region | Weeks | Requests (M) | p50 (ms) | p95 (ms) | Errors |
|---|---|---|---|---|---|
| ap-south | 12 | 1.8 | 59.20 | 142.15 | 2107 |
| eu-west | 13 | 4.0 | 40.05 | 98.90 | 4840 |
| us-east | 13 | 6.6 | 36.80 | 87.20 | 7893 |
ap-south is slower than the other two at both percentiles and is also the smallest by
volume, so its weekly numbers are the noisiest of the three. Any regional comparison has
to account for that noise.
Is the canary still slower?
The question is whether the canary channel carries a latency penalty once the region and the quarter-long trend are accounted for. Latency is right-skewed and multiplicative, so the model is fitted on the log scale, which makes every coefficient a proportional effect rather than a fixed number of milliseconds:
with eu-west and stable as the reference levels and the ISO week centred on
week 27.
# The model written out rather than handed to a formula library: it is five columns, so
# the design matrix IS the specification and there is nothing a formula string would make
# clearer. Treatment coding against `eu-west` and `stable`, so every coefficient reads as
# an effect relative to the reference level.
=
"""OLS of log(p95) on region + channel + week centred on week 27.
Returns one row per term with the estimate, its standard error and a two-sided
p-value, which is what a tidy coefficient table carries.
"""
=
=
=
=
=
=
, * =
= - @
= -
= *
=
return
=
=
# A bare `coefficient_table` would render pandas' own repr: a `border="1"` table tagged
# `class="dataframe"`, carrying a `<style scoped>` block and a row-index column. `to_html`
# with the index and the border off emits plain markup the page's own styling can reach.
| Term | Estimate (log) | SE | Factor | p |
|---|---|---|---|---|
| Intercept (eu-west, stable, week 27) | 4.676 | 0.019 | 107.320 | <0.001 |
| Region: us-east | -0.113 | 0.018 | 0.893 | <0.001 |
| Region: ap-south | 0.366 | 0.018 | 1.441 | <0.001 |
| Channel: canary | 0.092 | 0.015 | 1.097 | <0.001 |
| Per week elapsed | -0.020 | 0.002 | 0.980 | <0.001 |
The three floats on this page were made three different ways, and the two tables share one counter. Figure 1 is a matplotlib figure the page drew as it built, Table 1 is a markdown table typed into the source by hand, and Table 2 is a pandas frame a cell displayed. They are numbered in the order they appear, whichever path produced them, and each reference in this paragraph is a link to the float it names.
Over the quarter as a whole the canary channel is still measurably slower than stable, and that pooled coefficient hides the convergence the chart shows, because a single channel term has to split the difference between a large early penalty and no penalty by week 39.