...of perf counter name.
So that mds_mem_dir- becomes mds_mem_dir_minus, but
throttle-filestore_bytes becomes throttle_filestore_bytes.
At some point once this is all settled we should
probably just change Ceph's internal perf counter
naming to satisfy the major TSDB naming rules.
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit
29ac9270d43a225bb2336adaaf813c12e12a715a)
def promethize(path):
''' replace illegal metric name characters '''
- return path.replace('.', '_').replace('-', '_minus').replace('+', '_plus')
+ result = path.replace('.', '_').replace('+', '_plus')
+
+ # Hyphens usually turn into underscores, unless they are
+ # trailing
+ if result.endswith("-"):
+ result = result[0:-1] + "_minus"
+ else:
+ result = result.replace("-", "_")
+
+ return result
def floatstr(value):
''' represent as Go-compatible float '''