Skip to content

Commit

Permalink
mgr/telemetry: revise format_perf_histogram
Browse files Browse the repository at this point in the history
osd_perf_histograms now include only separated stats; remove the
aggregated formatting; we can revert this in case we ever add aggregated
histograms.

Signed-off-by: Yaarit Hatuka <[email protected]>
  • Loading branch information
yaarith committed Jan 13, 2022
1 parent 30c4944 commit 2197f7e
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/pybind/mgr/telemetry/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,22 +1295,17 @@ def format_perf_histogram(self, report: Dict[str, Any]) -> None:
# they are displayed horizontally instead of vertically.
try:
# Formatting ranges and values in osd_perf_histograms
modes_to_be_formatted = ['osd_perf_histograms_aggregated', 'osd_perf_histograms_separated']
for mode in modes_to_be_formatted:
for config in report[mode]:
for histogram in config:
# Adjust ranges by converting lists into strings
for axis in config[histogram]['axes']:
for i in range(0, len(axis['ranges'])):
axis['ranges'][i] = str(axis['ranges'][i])
# Adjust values by converting lists into strings
if mode == 'osd_perf_histograms_aggregated':
for i in range(0, len(config[histogram]['values'])):
config[histogram]['values'][i] = str(config[histogram]['values'][i])
else: # if mode == 'osd_perf_histograms_separated'
for osd in config[histogram]['osds']:
for i in range(0, len(osd['values'])):
osd['values'][i] = str(osd['values'][i])
mode = 'osd_perf_histograms'
for config in report[mode]:
for histogram in config:
# Adjust ranges by converting lists into strings
for axis in config[histogram]['axes']:
for i in range(0, len(axis['ranges'])):
axis['ranges'][i] = str(axis['ranges'][i])

for osd in config[histogram]['osds']:
for i in range(0, len(osd['values'])):
osd['values'][i] = str(osd['values'][i])
except KeyError:
# If the perf channel is not enabled, there should be a KeyError since
# 'osd_perf_histograms' would not be present in the report. In that case,
Expand Down

0 comments on commit 2197f7e

Please sign in to comment.