mirror of
https://github.com/hanzoai/insights-python.git
synced 2026-10-30 18:33:17 +00:00
Replaces the first cut, which captured one event per measurement. That was the wrong plane and the wrong shape: it attached a distinct_id to a system measurement and put one event on the wire per sample, which is the per-series cardinality explosion this design exists to avoid. Samples now fold into per-series aggregates in memory — counts sum, gauges keep the last value, histograms accumulate buckets — and flush as one OTLP data point per series per window to /i/v1/metrics, the plane the product already ingests through (insights/otel_metrics.py). Delta temporality, so a data point stands alone and a restart needs no cross-window state. Same wire shape as the JS SDK. Client.metrics is lazy and no-throw: a bad metrics config degrades to defaults rather than raising from the first chained count(). shutdown() flushes what is pending.