From 95b6912045b5d23ae823d6733beb7f315b010528 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 3 May 2018 15:51:04 +0100 Subject: [PATCH 1/2] Fix metrics that have integer value labels --- synapse/metrics/metric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py index fbba94e63..98d5ca7b6 100644 --- a/synapse/metrics/metric.py +++ b/synapse/metrics/metric.py @@ -324,4 +324,4 @@ def _escape_character(m): def _escape_label_value(value): """Takes a label value and escapes quotes, newlines and backslashes """ - return re.sub(r"([\n\"\\])", _escape_character, value) + return re.sub(r"([\n\"\\])", _escape_character, str(value)) From 6d8ec3462d33daa5d390fca206ec2e281c27c38f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 3 May 2018 16:25:05 +0100 Subject: [PATCH 2/2] Note that label values can be anything --- synapse/metrics/metric.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py index 98d5ca7b6..f421e7a93 100644 --- a/synapse/metrics/metric.py +++ b/synapse/metrics/metric.py @@ -71,7 +71,8 @@ class BaseMetric(object): """Render this metric for a single set of labels Args: - label_values (list[str]): values for each of the labels + label_values (list[object]): values for each of the labels, + (which get stringified). value: value of the metric at with these labels Returns: