in theory, there is chance that get_metadata() returns None, so let use
"N/A" in this case.
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
e457ca50011f70cf01a62323998af233a484f338)
for daemon, counters in six.iteritems(self.get_all_perf_counters()):
svc_type, svc_id = daemon.split(".", 1)
metadata = self.get_metadata(svc_type, svc_id)
+ if metadata is not None:
+ hostname = metadata['hostname']
+ else:
+ hostname = 'N/A'
for path, counter_info in counters.items():
if counter_info['type'] & self.PERFCOUNTER_HISTOGRAM:
"tags": {
"ceph_daemon": daemon,
"type_instance": path,
- "host": metadata['hostname'],
+ "host": hostname,
"fsid": self.get_fsid()
},
"time": now,