From 5f0ef3a73a55a3f24997e415a848308afa0263ba Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 4 Aug 2017 10:23:11 +0200 Subject: [PATCH] pybind/mgr/prometheus: prefix metrics with 'ceph'; replace :: with _ Both follow prometheus best practices. While : is a legal metric character, "Exposed metrics should not contain colons, these are for users to use when aggregating." Signed-off-by: Jan Fajerski (cherry picked from commit 177afcc7886aa3898d092ebd1e101697bc6539fd) --- src/pybind/mgr/prometheus/module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 82e6a077dab74..95d7bff32775a 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -76,7 +76,7 @@ class Metric(object): def promethize(path): ''' replace illegal metric name characters ''' - result = path.replace('.', '_').replace('+', '_plus') + result = path.replace('.', '_').replace('+', '_plus').replace('::', '_') # Hyphens usually turn into underscores, unless they are # trailing @@ -85,7 +85,7 @@ class Metric(object): else: result = result.replace("-", "_") - return result + return "ceph_{0}".format(result) def floatstr(value): ''' represent as Go-compatible float ''' -- 2.39.5