ai-assisted-todolist

Observability#

What watches TaskFest, as built (checked against deployment/aws-tofu on 2026-11-14, #558). The Go backend serves qa and prod. The architecture diagram draws how it is watched.

The Go backend (qa and prod, #557):

The containers went from the infrastructure in #557, and with them their log group, its saved queries and the up-time reminder; this page in the tag pre-serverless (opens in a new tab) describes what watched them.

Besides:

Plan: how long a page takes to show (#236)#

Not built yet; this is the plan #236 asked for. The question is how long the board takes from the click to tasks and previews on screen, and where that time goes. Four steps, cheapest first, each useful on its own:

  1. Measure in the lab, against qa, in the live run. Playwright already signs in on qa after every deploy. A spec reads the browser's own timings — Navigation Timing, Largest Contentful Paint, and Resource Timing per preview, whose transferSize of 0 shows a cache hit — and writes them to the run summary. Free, the same every time, and enough to show before and after a change such as thumbnails. It says nothing about real networks or devices.
  2. Mark the application's own moments. performance.mark when the task list has arrived and when the board has rendered it, so the timings name "board ready" rather than only the browser's generic events. A few lines in the frontend, read by step 1 and step 3 alike.
  3. Collect from real browsers. The timings of step 1 and 2, sent with navigator.sendBeacon once a page has settled: either to a small backend endpoint that logs them as a structured line — CloudWatch Logs Insights then gives percentiles, at no new cost — or to CloudWatch RUM, managed, at about a dollar per 100,000 events. Either way it is data about visitors, so the privacy policy changes with it, and the decision is Gunnar's.
  4. Trace the backend's part. A Server-Timing header first: the browser shows it in its developer tools and in Resource Timing, so steps 1 and 3 see the backend's share without a tracing system. OpenTelemetry (quarkus-opentelemetry) to X-Ray, with the browser's requests carrying traceparent, only once there is more than one service to follow a request through — as the bullet on traces above says.

Alerting: the address, and the one-time setup#

The address the alerts go to is not in the repository. It lives in an SSM parameter, /taskfest/alert-email, one for the account, which alerting.tf reads; a standard String parameter is free. Create it once, before the first apply that includes alerting.tf -- the plan fails without it:

aws ssm put-parameter --name /taskfest/alert-email --type String --value '<the address>'

After each environment's apply, AWS mails that address a confirmation link per topic (one for qa, one for prod), and nothing is delivered until it is clicked. A topic that is ever destroyed and created again needs its link clicked again. To change the address, overwrite the parameter (--overwrite) and apply both environments.

The orphan alarm (taskfest-<env>-orphan-alert) counts the orphanSweepAlert lines of the orphans function, with a metric filter, and goes to ALARM when an hour holds one, mailing on entering ALARM and on returning to OK. attachments.md says when the backend writes that line.

The monitoring server#

Gunnar's shared monitoring, VictoriaMetrics, VictoriaLogs and Perses on one Hetzner VM, lives in guhilling/monitoring (opens in a new tab) (private), which says how it is set up and reached. TaskFest sends it the Go backend's logs from the environments that set monitoring_endpoint in terraform.tfvars: qa, and prod since #631.

How they get there (monitoring.tf). A CloudWatch Logs subscription filter on each of the Go backend's log groups -- the other five functions' and the HTTP API's access log -- hands every batch of lines to the function taskfest-<env>-logship, which posts them to the server's VictoriaLogs (/insert/jsonline) over HTTPS, with basic auth as the user taskfest-<env>. CloudWatch keeps every line as before, so nothing is lost when the server is away: Lambda retries a failed batch twice and then drops it. logship's own log is not sent.

What a line becomes (serverless/internal/logship). Each carries project (taskfest), env and source -- api, api-access, streams, orphans, replay, push -- which are its stream. A JSON line keeps its fields, its msg becoming the message; the access log's path becomes a route with its ids as {id}, beside method, status and latencyMs; Lambda's REPORT line becomes durationMs, billedDurationMs, maxMemoryUsedMB, after a cold start initDurationMs, and for an invocation that did not end well its invocationStatus, such as timeout. The lines that only mark an invocation's start and end are left out. This is where the dashboards' latency and error figures come from: the Go backend has no metrics endpoint.

What leaves AWS: the sign-in line's user, the OIDC subject, is personal data, which is why the privacy texts name Hetzner for the environments that send; the ids of the tasks and attachments some lines name go too, though not their content. The access log holds no IP address. VictoriaLogs keeps everything for 30 days, as qa's CloudWatch does; prod's CloudWatch keeps 90.

Switching an environment on, in this order, the first two by Gunnar: 1. The server answers at its name with a certificate, and its Caddy knows the sender (the server page (opens in a new tab) (private)). 2. The sender's password, the same one whose hash Caddy has, as an SSM SecureString:

aws ssm put-parameter --name /taskfest/<env>/monitoring-password --type SecureString \
  --value '<password>'
3. monitoring_endpoint = "https://monitoring.cloud.hilling.de" in the environment's terraform.tfvars, and the privacy texts naming Hetzner for it, in one pull request; then env.sh up <env> as the administrator, since the apply adds permissions and filters. Without the parameter the plan stops at the data source, before anything changes. 4. A redeploy of the release that runs, with deploy-serverless.yml: the apply sets logship's settings, which reach what serves only as a newly published version (serverless.md). Until then the filters invoke the version published without an endpoint, which logs a warning and sends nothing.

Cost: logship runs once per batch, a few thousand times a month at the demo's traffic, inside Lambda's free tier; the subscription filters cost nothing; data leaving AWS is about $0.09/GB, cents. The server is a fixed ~€6 a month, shared with other workloads (#508).