]> 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, 27 Sep 2017 18:18:00 +0000 (14:18 -0400)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/pybind/mgr/prometheus/module.py

index aeb464b1a486d4676b78fb05658db49aa7550766..c246449f9fd07eecc2e769da601a7390cd8abcd0 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()