]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/prometheus: actually emit reported pg counts
authorJan Fajerski <jfajerski@suse.com>
Thu, 10 Aug 2017 16:15:56 +0000 (18:15 +0200)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:23 +0000 (23:03 +0000)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit c288624eed862559b2c86c5dfc85c837716739ab)

src/pybind/mgr/prometheus/module.py

index 27184497a39fe8d5c623f3a7d55bffbbd750caa8..35af2db1df33e2de2734cda6d76a7f5ac7ff2faa 100644 (file)
@@ -310,10 +310,15 @@ class Module(MgrModule):
         for osd in pg_s:
             reported_pg_s = [(s,v) for key, v in pg_s[osd].items() for s in
                              key.split('+')]
+            for state, value in reported_pg_s:
+                path = 'pg_{}'.format(state)
+                self.metrics[path].set(value, (osd,))
+            reported_states = [s[0] for s in reported_pg_s]
             for state in PG_STATES:
                 path = 'pg_{}'.format(state)
-                if state not in reported_pg_s:
-                    self.metrics[path].set(0, ('osd.{}'.format(osd),))
+                self.log.debug('rep_pgs: {}'.format(reported_pg_s))
+                if state not in reported_states:
+                    self.metrics[path].set(0, (osd,))
 
     def collect(self):
         self.get_health()