metrics.ts21 lines · main
| 1 | import { createMetricsRegistry } from '@briven/shared/observability'; |
| 2 | |
| 3 | /** |
| 4 | * realtime's metrics registry. Surface (incCounter / registerGauge / |
| 5 | * renderPrometheus) is preserved so the call sites in `index.ts` are |
| 6 | * unchanged. Histograms aren't used today; the registry supports them |
| 7 | * if a latency metric lands later. |
| 8 | */ |
| 9 | const registry = createMetricsRegistry({ |
| 10 | help: { |
| 11 | briven_realtime_subscriptions_active: 'Active websocket subscriptions', |
| 12 | briven_realtime_channels_active: 'Distinct channels currently watched via commit-diff polling', |
| 13 | briven_realtime_notifies_total: 'Total change events detected via Dolt commit-diff polling', |
| 14 | briven_realtime_reinvoke_total: |
| 15 | 'Total function re-invocations triggered by change events, by outcome', |
| 16 | }, |
| 17 | }); |
| 18 | |
| 19 | export const incCounter = registry.incCounter; |
| 20 | export const registerGauge = registry.registerGauge; |
| 21 | export const renderPrometheus = registry.render; |