@adalo/metrics 0.1.174 → 0.1.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +13 -14
  2. package/__tests__/httpMetricsRedisCollector.test.js +105 -1
  3. package/__tests__/httpMetricsRedisRecorder.test.js +22 -3
  4. package/lib/metrics/baseMetricsClient.d.ts +1 -1
  5. package/lib/metrics/baseMetricsClient.d.ts.map +1 -1
  6. package/lib/metrics/baseMetricsClient.js +1 -1
  7. package/lib/metrics/baseMetricsClient.js.map +1 -1
  8. package/lib/metrics/httpMetricsRedisCollector.d.ts +30 -24
  9. package/lib/metrics/httpMetricsRedisCollector.d.ts.map +1 -1
  10. package/lib/metrics/httpMetricsRedisCollector.js +65 -34
  11. package/lib/metrics/httpMetricsRedisCollector.js.map +1 -1
  12. package/lib/metrics/httpMetricsRedisRecorder.d.ts +9 -17
  13. package/lib/metrics/httpMetricsRedisRecorder.d.ts.map +1 -1
  14. package/lib/metrics/httpMetricsRedisRecorder.js +18 -16
  15. package/lib/metrics/httpMetricsRedisRecorder.js.map +1 -1
  16. package/lib/metrics/metricsClient.d.ts +1 -63
  17. package/lib/metrics/metricsClient.d.ts.map +1 -1
  18. package/lib/metrics/metricsClient.js +1 -77
  19. package/lib/metrics/metricsClient.js.map +1 -1
  20. package/lib/metrics/metricsProcessTypeUtils.d.ts +17 -9
  21. package/lib/metrics/metricsProcessTypeUtils.d.ts.map +1 -1
  22. package/lib/metrics/metricsProcessTypeUtils.js +18 -9
  23. package/lib/metrics/metricsProcessTypeUtils.js.map +1 -1
  24. package/package.json +3 -2
  25. package/src/metrics/baseMetricsClient.js +1 -1
  26. package/src/metrics/httpMetricsRedisCollector.js +78 -43
  27. package/src/metrics/httpMetricsRedisRecorder.js +23 -15
  28. package/src/metrics/metricsClient.js +1 -93
  29. package/src/metrics/metricsProcessTypeUtils.js +20 -9
  30. package/docs/http-metrics-redis.md +0 -19
@@ -1,19 +0,0 @@
1
- # HTTP metrics via Redis (`HttpMetricsRedisRecorder` / `HttpMetricsRedisCollector`)
2
-
3
- This file is a **quick entry point** for the Redis-backed HTTP aggregation path. **Full architecture, env vars, and diagrams** are in the repository guide:
4
-
5
- **[docs/METRICS.md](../../docs/METRICS.md)**
6
-
7
- ## Cheat sheet
8
-
9
- | Concern | Detail |
10
- |--------|--------|
11
- | **Writers** | `HttpMetricsRedisRecorder` — Express middleware records `method`, `route`, `status_code`, duration into Redis hashes. |
12
- | **Reader** | `HttpMetricsRedisCollector` — separate process calls `pushMetrics()`, which **drains** Redis (atomic Lua) and increments `app_requests_*`, then pushes to VM-agent. |
13
- | **Redis key shape** | `metrics:http:v2:<encode(appName)>:<encode(processType)>:count` and `:dur` — two hashes per writer group. |
14
- | **Hash field** | Three logical parts: method, route, HTTP status (joined with an internal `FIELD_SEP`). |
15
- | **Prometheus labels** | `method`, `route`, `status_code` (plus default `app` / `process_type` without `dyno_id` on these counters). |
16
- | **Backend** | Web: `backend/monitoring.ts` + `METRICS_HTTP_ENABLED`. Drain: `backend/http-metrics-collector.ts`, Procfile `http-metrics:`. |
17
- | **Prime 0 on new routes** | The first time a `(method, route, status_code)` appears **in this process**, the collector `inc(..., 0)` for count+duration on **that label set only**, **POST**, then applies drained counts for **all** rows. Existing series are **not** touched in the prime loop — e.g. in-memory `b` was **18**, drain has new `a:1` and `b:20`: prime push exports **`a=0`, `b=18`**; after apply, final push has **`a=1`, `b=38`**. If **all** label sets were already seen, there is **no** extra prime `POST`. |
18
-
19
- For in-process HTTP metrics **without** Redis, see **`MetricsClient`** + `METRICS_HTTP_ENABLED` in **[docs/METRICS.md](../../docs/METRICS.md#http-metrics-two-valid-designs)**.