Grafana
Dashboards + alerting. Google OAuth sign-in; alerts fan out to Discord.
Huddle runs a self-hosted Grafana LGTM stack, driven by OpenTelemetry. It
lives in the observability
repo (a Railway template) and every service ships telemetry to it over Railway’s
private network.
Grafana
Dashboards + alerting. Google OAuth sign-in; alerts fan out to Discord.
Prometheus
Metrics (remote-write receiver). 7-day / 1 GB retention.
Loki
Logs (OTLP + Faro). 14-day retention, structured-metadata enabled.
Tempo
Traces. 14-day retention (block_retention: 336h); runs the local-blocks
processor for TraceQL metrics.
Grafana Alloy
The collector — OTLP receiver, blackbox prober, and the span-metrics / service-graph connectors.
All telemetry flows through Alloy (alloy/config.alloy).
:4318 (HTTP) → routes metrics, logs, and traces to their
exporters (Prometheus remote-write, Loki, Tempo).instance label promoted from service.instance.id (or
replica.id for the app). This is load-bearing: without a per-replica
instance label, two replicas emit the same series and Prometheus rejects the
batch with “duplicate sample for timestamp … overrides not allowed.”
Span-metrics are the exception (observability #11): the spanmetrics connector
keys its output by service.name + deployment.environment only
(resource_metrics_key_attributes), so replicas fold into one stream per
service and environment, and their instance is just the first replica Alloy
saw since it started. Before that change, every replica a deploy retired
stayed cached and was re-exported every 15s until Alloy restarted.traces_spanmetrics_*) — RED metrics, with extra
dimensions deployment.environment and workflow.type. (It used to promote
org.id too; that multiplied every span-metric series by the tenant count and
no panel grouped by it. org.id remains a span attribute on App spans for
Tempo filtering.)otelpgx client spans (which carry db.namespace/db.system,
not legacy db.name) are recognized as DB requests so the
API → Postgres edge shows up. The API now also traces its S3 (Tigris)
client calls (otelaws instrumentation, aws.s3.bucket/aws.s3.key
attributes on operation-named spans such as S3.GetObject), so
object-storage calls likewise appear as CLIENT spans in the API’s traces.workflow_span_kind transform promotes INTERNAL RunWorkflow:*
spans to SERVER. The TypeScript SDK’s OTel interceptors emit every
workflow span as INTERNAL (Go emits CLIENT/SERVER, Python emits SERVER),
and the servicegraph connector skips INTERNAL spans — so without this
the API → Notification edge never formed. Promoting them matches what
the Python workers already emit.virtual_node_peer_attributes and the connector store ttl (15s) are
tuned so client/server spans reliably pair (they only pair while both sit
in the store) without misclassifying the Notification → API / → Resend
HTTP calls as virtual nodes.decision_wait = 15s, buffering up to 50k traces).
The decision is made per whole trace, so a kept trace retains all of its
app → api → rag spans rather than shattering into rootless fragments. The
spanmetrics and servicegraph connectors deliberately read the unsampled
100% stream — computing span metrics after a 10% sample would undercount
request rates ~10× and drop edges.Prometheus pre-collapses the high-churn instance label off the series that
dashboards aggregate away anyway (prometheus/rules.yaml, loaded via
rule_files). Four rules record the summed counter rather than a rate, so
panels keep their rate() / histogram_quantile() shapes and only swap the
metric name. This exists because each Railway deploy used to leave a new
instance value on every series: over 30 days the raw span-metric series grew
~12× while the aggregated answer stayed constant. Span-metrics no longer churn
per deploy (they’re keyed per service and environment since observability #11),
but the rules still serve the resource metrics and the history recorded before
that change. The rules do not backfill, so history accrues only
from the moment they shipped.
Alloy’s blackbox exporter probes service health endpoints every 60 seconds. App and API are probed across all three environments (development included); the two shared-infra targets — LiteLLM and Temporal — are production only:
| Target | Endpoint | Module |
|---|---|---|
| App (dev / staging / prod) | /api/health |
http_2xx |
| API (dev / staging / prod) | / |
http_2xx |
| LiteLLM (prod) | /health/liveliness |
http_2xx |
| Temporal (prod) | gRPC health check | grpc_health |
This produces probe_success metrics — a reliable UP/DOWN signal decoupled from
the services’ own telemetry push. RAG and Notification have no HTTP endpoint, so
their “status” is derived from a Temporal worker metric instead —
temporal_num_pollers{poller_type="workflow_task"} (> bool 0), which stays
positive as long as the worker is polling its task queue. The Status dashboard
now has a row per monitored surface — App, API, RAG, Notification, Temporal,
and LiteLLM.
Provisioned dashboards, datasources, and alert rules (grafana/provisioning/).
App (process + Faro RUM + exceptions), API (process +
request RED + a tracing section with per-route latency, DB p95, and a service
graph; p95 by route leaves out the long-lived SSE …/watch streams, whose span
duration is connection lifetime rather than latency), RAG (process + LLM token/cost + workflow & activity metrics from
span-metrics + a TraceQL run table), Notification (process + an Emails
row from the notification.emails.sent counter — sent/failed/by-template —
plus workflow & activity metrics and a TraceQL run table, mirroring RAG), and
Status (per-service uptime). The service dashboards are filterable by an
$environment variable (defaulting to production on all four; App and API
used to open on staging), whose options are now derived from label values
(label_values(…, deployment_environment)) rather than a hardcoded
production/staging list — a new environment shows up without a dashboard
edit. The Status dashboard is the exception: its $environment selector was
removed and every query is pinned to deployment_environment="production"
(and namespace="production" for the worker rows), so it is a fixed
production-health board. Its per-service timeline panels were renamed
Status → History and the board now defaults to the last 30 days
(was 7).Alert rules exist for App / API / RAG only — Notification has a Status
dashboard row (same temporal_num_pollers liveness query) but no alert
rules yet. Each covers Status (App/API on probe_success == 0; RAG on
temporal_num_pollers{poller_type="workflow_task"} == 0 — for: 3–5m), CPU,
Memory, and Network (for: 10m), all notifying a single Discord
contact point.
All rules now live in a single Alerts folder grouped by service — the
earlier layout used a per-service folder with a production group each. Because
the folder no longer disambiguates the alert name in a notification, every rule
title now carries a service prefix (e.g. API Status, RAG Memory).
A single request is traced browser → app → api → worker (RAG or
Notification) into one Tempo trace. Each service exports spans over OTLP to
Alloy, and trace context propagates across each boundary by a different
mechanism — inject-only at the browser edge, manual traceparent injection
app → api, and a Temporal ContextPropagator (plus the requester’s workflow token) across
the api → worker Temporal boundary.
This has enough moving parts to warrant its own page:
To control egress and cardinality:
instance label is the only per-replica dimension promoted, and only
span-metrics drop it (they’re keyed per service and environment) — identity is
carried as org (not user) to keep span/metric cardinality bounded.