Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pacific: cephfs-top: include additional metrics reported by fs perf stats #40422

Merged
merged 2 commits into from Mar 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/tools/cephfs/top/cephfs-top
Expand Up @@ -56,6 +56,9 @@ MAIN_WINDOW_TOP_LINE_METRICS = OrderedDict([
("WRITE_LATENCY", MetricType.METRIC_TYPE_LATENCY),
("METADATA_LATENCY", MetricType.METRIC_TYPE_LATENCY),
("DENTRY_LEASE", MetricType.METRIC_TYPE_PERCENTAGE),
("OPENED_FILES", MetricType.METRIC_TYPE_NONE),
("PINNED_ICAPS", MetricType.METRIC_TYPE_NONE),
("OPENED_INODES", MetricType.METRIC_TYPE_NONE),
])
MGR_STATS_COUNTERS = list(MAIN_WINDOW_TOP_LINE_METRICS.keys())

Expand Down Expand Up @@ -130,6 +133,10 @@ class FSTop(object):
stats_json = self.perf_stats_query()
if not stats_json['version'] == FS_TOP_SUPPORTED_VER:
raise FSTopException('perf stats version mismatch!')
missing = [m for m in stats_json["global_counters"] if m.upper() not in MGR_STATS_COUNTERS]
if missing:
raise FSTopException('Cannot handle unknown metrics from \'ceph fs perf stats\': '
f'{missing}')

def setup_curses(self):
self.stdscr = curses.initscr()
Expand Down Expand Up @@ -173,6 +180,7 @@ class FSTop(object):
elif typ == MetricType.METRIC_TYPE_LATENCY:
return "(s)"
else:
# return empty string for none type
return ''

def refresh_top_line_and_build_coord(self):
Expand Down Expand Up @@ -228,6 +236,9 @@ class FSTop(object):
self.mainw.addstr(y_coord, coord[0], f'{calc_perc(m)}')
elif typ == MetricType.METRIC_TYPE_LATENCY:
self.mainw.addstr(y_coord, coord[0], f'{calc_lat(m)}')
else:
# display 0th element from metric tuple
self.mainw.addstr(y_coord, coord[0], f'{m[0]}')
else:
self.mainw.addstr(y_coord, coord[0], "N/A")
cidx += 1
Expand Down