Skip to content

Commit

Permalink
🚑 use prometheus interface properly (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyemwey authored Jan 29, 2024
1 parent 0090246 commit ebae0b8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions app/Providers/PrometheusServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ public function register() {
*/
Prometheus::addGauge('Users count')
->helpText("How many users are registered on the website?")
->labels(["created", "deleted"])
->value(fn() => [
Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::UserCreated)),
Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::UserDeleted))
]);
->label("state")
->value(function() {
return [
[Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::UserCreated)), ["created"]],
[Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::UserDeleted)), ["deleted"]]
];
});


Prometheus::addGauge('Status count')
->helpText("How many statuses are posted on the website?")
->labels(["created", "deleted"])
->value(fn() => [
Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::StatusCreated)),
Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::StatusDeleted))
]);
->label("state")
->value(function() {
return [
[Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::StatusCreated)), ["created"]],
[Cache::get(CacheKey::getMonitoringCounterKey(MonitoringCounter::StatusDeleted)), ["deleted"]]
];
});

Prometheus::addGauge('Hafas Trips count')
->helpText("How many hafas trips are posted grouped by operator and mode of transport?")
Expand Down

0 comments on commit ebae0b8

Please sign in to comment.