Add observability: client-side errors, structured logs, Grafana dashboard, uptime probe #39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — discovered during live debugging of invisible client-side location feature failure (2026-05-26). GPS reverse geocode call was failing silently; all
.catch()blocks swallow errors with no logging or reporting.Repo
ldraney/landscaping-assistantUser Story
As the app operator
I want visibility into client-side JS errors, server exceptions, and app uptime
So that I can diagnose failures instead of flying blind when something breaks in production
Context
The app has zero observability beyond
kubectl logs. A transient client-side failure (Nominatim reverse geocode inlocation_controller.js) was completely invisible — all 6 Stimulus controllers silently swallow errors in.catch(() => { generic message })blocks. No console logging, no server notification.Server-side is slightly better (Rails STDOUT → Promtail → Loki), but there's no Grafana dashboard to query those logs and no alerting when the app is unreachable.
The platform already runs a full observability stack in the
monitoringnamespace — Prometheus, Loki (7d retention), Grafana (grafana.tail5b443a.ts.net), Alertmanager, Blackbox Exporter (14 probes for other services). This app isn't wired into any of it. This is a wiring + instrumentation task, not a deploy-new-infra task.Key decisions:
File Targets
Files to modify or create:
app/javascript/application.js— add globalwindow.onerror+unhandledrejectionhandlers that POST to/errors/clientapp/javascript/controllers/location_controller.js— addconsole.error(e)in.catch(), include error type in user messageapp/javascript/controllers/add_location_controller.js— same catch fixapp/javascript/controllers/upload_controller.js— same catch fix (and any other controllers with silent catches)app/controllers/client_errors_controller.rb— new endpoint that logs client errors viaRails.logger.errorconfig/routes.rb— addPOST /errors/clientrouteconfig/initializers/error_subscriber.rb— Rails error reporting subscriber (structured error logging)Gemfile— addlogrageconfig/environments/production.rb— enable lograge with JSON formatterFiles NOT in this repo (platform/infra side):
https://landscaping-assistant.tail5b443a.ts.net/up/upAcceptance Criteria
console.errorAND posted to the server endpoint{namespace="landscaping-assistant"}, request logs are single-line JSON with controller, action, status, durationTest Expectations
/errors/clientwith valid JSON payload returns 200 and logs the error/errors/clientwith invalid/oversized payload returns 422 (rate-limit/size guard)kubectl logswithin secondsbundle exec rspec spec/controllers/client_errors_controller_spec.rbConstraints
request.body.read(4096)limit is fine)config.silence_healthcheck_path = "/up")Checklist
Related
project-landscaping-assistant— project this affectsobservability-audit-2026-02-25— platform observability baselineplan-2026-02-25-platform-observability— platform observability plan (completed)