Observability
Traced at commit ffe4e48 ·
apps/api/src/app/observability/db-gauges.service.ts ·
libs/telemetry/src/lib/instruments.ts ·
tools/grafana/*.py ·
tools/observability/pilot-spec-manifest.psv
Summary
- A number on a board comes from one of three places.
- The application emits counters and timers as it works.
- A poller asks the database a fixed set of questions every 60 seconds.
- Some panels query the database directly when a person opens the board.
- 18 dashboards and 29 alerts read the result.
- Every metric that can tell real traffic from a rehearsal carries a label.
- The boards default to real traffic only.
- The platform has placed 4 real dials in total. Almost every board is therefore empty at that setting.
- The automatic campaign audit reuses the definitions of four compliance alerts. It posts to Slack, not to a board.
The three sources
- The application. The code emits a counter or a timer as each event happens.
- These arrive continuously and need no polling.
- The poller. A service asks the database a fixed set of questions every 60 seconds.
- The poller publishes each answer as a gauge.
- Use a gauge for a question about the current state, such as how many leads are in each state.
- A direct query. Some panels ask the database when a person opens the board.
- Use a direct query for an expensive question that no alert needs.
The rehearsal label
- Every metric that can distinguish traffic carries a rehearsal label.
- The boards have a Traffic control with three settings: real only, simulated only, and both.
- The default is real only.
- The platform has placed 4 real dials in total.
- At the default setting almost every board is therefore empty.
- That is the correct behaviour. It is not a fault.
- Three panels answer their question without a metric behind them. No alert can read them.
Failure mode 1 — a poller query grows slow
- The poller has a budget of 5 seconds for each cycle.
- A query that outgrows the budget fails.
- One slow query stops a whole family of numbers at once.
- The panels show no error. They stop moving.
- A panel that stopped moving and a panel reading zero look the same.
- Add an expensive question as a direct query, not as a gauge.
Failure mode 2 — a name stops matching reality
- A metric name, a label or a database key can stop matching what the code writes.
- The query still runs. It returns nothing, or it returns the wrong value.
- The board reports that value with full confidence.
- This platform has produced that failure several times.
- An index listed states that cannot occur, so it was never used.
- A gauge read
d2_partywhile the data usesd2Party. - A check queried a metric name that the exporter had renamed.
- A nightly job now compares every metric in the specification against what the platform emits.
Both failure modes are silent by design of the tooling. A dashboard has no way to show the difference between “this value is zero” and “nothing answered this question”. The nightly check exists because a person will not notice either one.
The campaign audit uses the same definitions
Traced at commit cf34e2f ·
libs/temporal/src/activities/campaign-audit{,-rules}.ts ·
libs/temporal/src/activities/call-review.ts
- The main worker audits each running campaign of a real organization every 15 minutes.
- It posts to the private Slack channel
#campaign-audits. It changes nothing on the platform. - The audit reads the database, the Temporal workflows and a review of each answered call.
- Four of its checks copy four Grafana rules exactly, with the same severity.
calls.disclosurecopiesva-disclosure-failures. Both are P1, and the audit gives a FAIL.calls.prohibited_claimcopiesva-prohibited-claim. Both are P1, and the audit gives a FAIL.calls.slow_engagementcopiesva-safe-harbour. Both are P2, and the audit gives a WARN.- That check counts calls with more than 2 s before the first agent words. It fires above 5 calls.
calls.recording_missingcopiesva-recording-missing. Both are P2, and the audit gives a WARN.- Each finding names its Grafana rule.
- The disclosure check counts only calls of 20 s or more, the same as the gauge.
- The audit counts only the calls that carry its campaign id.
- The audit does not read Grafana alert history or the metrics store.
One definition, two readers. The pager and the audit must agree about the same calls. A separate audit query would drift from the gauge, as in failure mode 2.
Cost and reconciliation — the family of numbers where this
distinction matters most.
Quality and safety nets — the
campaign audit and the conversation review, in plain terms.