Skip to content

Commit

Permalink
mgr/prometheus plugin: fix 2 bugs implemented by PR#48204, PR#49519
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/59505
Signed-off-by: banuchka <tyrchenok@gmail.com>
  • Loading branch information
banuchka committed Apr 21, 2023
1 parent d7ff0d1 commit 3031f19
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/pybind/mgr/prometheus/module.py
Expand Up @@ -750,6 +750,18 @@ def _setup_static_metrics(self) -> Dict[str, Metric]:
'healthcheck status by type (0=inactive, 1=active)',
HEALTHCHECK_DETAIL
)
metrics['pool_objects_repaired'] = Metric(
'counter',
'pool_objects_repaired',
'Number of objects repaired in a pool Count',
('poolid',)
)
metrics['daemon_health_metrics'] = Metric(
'counter',
'daemon_health_metrics',
'Health metrics for Ceph daemons',
('type', 'ceph_daemon',)
)

for flag in OSD_FLAGS:
path = 'osd_flag_{}'.format(flag)
Expand Down Expand Up @@ -1590,14 +1602,7 @@ def get_collect_time_metrics(self) -> None:
def get_pool_repaired_objects(self) -> None:
dump = self.get('pg_dump')
for stats in dump['pool_stats']:
path = f'pool_objects_repaired{stats["poolid"]}'
self.metrics[path] = Metric(
'counter',
'pool_objects_repaired',
'Number of objects repaired in a pool Count',
('poolid',)
)

path = 'pool_objects_repaired'
self.metrics[path].set(stats['stat_sum']['num_objects_repaired'],
labelvalues=(stats['poolid'],))

Expand All @@ -1606,13 +1611,7 @@ def get_all_daemon_health_metrics(self) -> None:
self.log.debug('metrics jeje %s' % (daemon_metrics))
for daemon_name, health_metrics in daemon_metrics.items():
for health_metric in health_metrics:
path = f'daemon_health_metrics{daemon_name}{health_metric["type"]}'
self.metrics[path] = Metric(
'counter',
'daemon_health_metrics',
'Health metrics for Ceph daemons',
('type', 'ceph_daemon',)
)
path = 'daemon_health_metrics'
self.metrics[path].set(health_metric['value'], labelvalues=(
health_metric['type'], daemon_name,))

Expand Down

0 comments on commit 3031f19

Please sign in to comment.