Fix Set calls to gauges
Fixes #2150 The proper function is `Set` (not `set`), which was causing these gauges to not report to Prometheus
This commit is contained in:
parent
ee99929f56
commit
e29cb34336
2 changed files with 7 additions and 6 deletions
|
@ -116,8 +116,8 @@ class WorkQueue(object):
|
||||||
dimensions=dim)
|
dimensions=dim)
|
||||||
self._metric_queue.put_deprecated('Available', available_count, dimensions=dim)
|
self._metric_queue.put_deprecated('Available', available_count, dimensions=dim)
|
||||||
|
|
||||||
self._metric_queue.work_queue_running.set(running_count, labelvalues=[self._queue_name])
|
self._metric_queue.work_queue_running.Set(running_count, labelvalues=[self._queue_name])
|
||||||
self._metric_queue.work_queue_available.set(available_count, labelvalues=[self._queue_name])
|
self._metric_queue.work_queue_available.Set(available_count, labelvalues=[self._queue_name])
|
||||||
|
|
||||||
if self._reporter:
|
if self._reporter:
|
||||||
self._reporter(self._currently_processing, running_count,
|
self._reporter(self._currently_processing, running_count,
|
||||||
|
|
|
@ -26,18 +26,19 @@ class GlobalPrometheusStatsWorker(Worker):
|
||||||
with GlobalLock('GLOBAL_PROM_STATS'):
|
with GlobalLock('GLOBAL_PROM_STATS'):
|
||||||
self._report_stats()
|
self._report_stats()
|
||||||
except LockNotAcquiredException:
|
except LockNotAcquiredException:
|
||||||
|
logger.debug('Could not acquire global lock for global prometheus stats')
|
||||||
return
|
return
|
||||||
|
|
||||||
def _report_stats(self):
|
def _report_stats(self):
|
||||||
logger.debug('Reporting global stats')
|
logger.debug('Reporting global stats')
|
||||||
with UseThenDisconnect(app.config):
|
with UseThenDisconnect(app.config):
|
||||||
# Repository count.
|
# Repository count.
|
||||||
metric_queue.repository_count.set(model.repository.get_repository_count())
|
metric_queue.repository_count.Set(model.repository.get_repository_count())
|
||||||
|
|
||||||
# User counts.
|
# User counts.
|
||||||
metric_queue.user_count.set(model.user.get_active_user_count())
|
metric_queue.user_count.Set(model.user.get_active_user_count())
|
||||||
metric_queue.org_count.set(model.organization.get_active_org_count())
|
metric_queue.org_count.Set(model.organization.get_active_org_count())
|
||||||
metric_queue.robot_count.set(model.user.get_robot_count())
|
metric_queue.robot_count.Set(model.user.get_robot_count())
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Reference in a new issue