Skip to content

feat(observability): ingestion + storage metrics (measure before scaling) - #44

Merged
ClaraVnk merged 1 commit into
mainfrom
feat/ingestion-metrics
Jun 30, 2026
Merged

feat(observability): ingestion + storage metrics (measure before scaling)#44
ClaraVnk merged 1 commit into
mainfrom
feat/ingestion-metrics

Conversation

@ClaraVnk

Copy link
Copy Markdown
Contributor

Context

Phase 5 "scale" — done the responsible way. Rather than migrate the store blind,
measure first: expose the metrics that will tell us when to scale.

Changes

  • ghostmon_values_ingested_total (counter → throughput via rate()) incremented on
    every history write (values endpoint/agent, SNMP poller, probe status/latency/error
    mirror).
  • ghostmon_table_rows_estimate{table=metric_values|metric_trends|monitor_results}
    (gauge) refreshed every 5 min from pg_class.reltuples — instant, no count(*).
  • Lives in app/core/observability.py (keeps core's dependencies inward). Exposed on
    the existing /metrics.

Distributed collection / TSDB stay deferred — now with data to trigger them.

Tests

Counter increments on record_value; the size gauge reflects the table. Full suite
219 passed; ruff + mypy(strict) green.

…ing)

Make the time-series load measurable so the eventual scaling decision (partitioning,
a TSDB) is evidence-driven rather than premature — the responsible first step of the
Phase-5 "scale" thread.

- app/core/observability.py: `ghostmon_values_ingested_total` (counter; `rate()` is
  ingestion throughput) and `ghostmon_table_rows_estimate{table=…}` (gauge), the
  latter sampled every 5 min from `pg_class.reltuples` — instant, no expensive
  `count(*)` on a growing history table.
- `count_ingested()` is called on every history write (the values endpoint/agent via
  record_value, the SNMP poller, and the probe status/latency/error mirror). A
  scheduler job refreshes the size gauges. Exposed on the existing `/metrics`.
- The module lives in `app/core` (neutral) to keep the layering inward.

The destructive scale work (distributed collection, TSDB) stays deferred — now with
data to trigger it. Tests: the counter increments on record_value and the size gauge
reflects the table. Full suite 219 passed; ruff + mypy(strict) green.
@ClaraVnk
ClaraVnk merged commit 3087678 into main Jun 30, 2026
4 checks passed
@ClaraVnk
ClaraVnk deleted the feat/ingestion-metrics branch June 30, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant