1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-02 01:17:58 +02:00
unleash.unleash/src/lib/features/instance-stats
Gastón Fournier a9f9be1efa
chore: add a class to handle aggreggation queries (#8446)
## About the changes
We have many aggregation queries that run on a schedule:
f63496d47f/src/lib/metrics.ts (L714-L719)

These staticCounters are usually doing db query aggregations that
traverse tables and we run all of them in parallel:
f63496d47f/src/lib/metrics.ts (L410-L412)

This can add strain to the db. This PR suggests a way of handling these
queries in a more structured way, allowing us to run them sequentially
(therefore spreading the load):
f02fe87835/src/lib/metrics-gauge.ts (L38-L40)

As an additional benefit, we get both the gauge definition and the
queries in a single place:
f02fe87835/src/lib/metrics.ts (L131-L141)

This PR only tackles 1 metric, and it only focuses on gauges to gather
initial feedback. The plan is to migrate these metrics and eventually
incorporate more types (e.g. counters)

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-10-18 11:11:22 +02:00
..
createInstanceStatsService.ts feat: start populating user first seen column (#8010) 2024-08-29 10:45:30 +02:00
getActiveUsers.e2e.test.ts fix: added await to getActiveUsers tests 2023-10-10 13:23:20 +02:00
getActiveUsers.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
getProductionChanges.e2e.test.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
getProductionChanges.ts chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
instance-stats-service.test.ts chore: add a class to handle aggreggation queries (#8446) 2024-10-18 11:11:22 +02:00
instance-stats-service.ts chore: add a class to handle aggreggation queries (#8446) 2024-10-18 11:11:22 +02:00