aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_metrics.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-02-03 08:30:40 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-02-03 08:30:40 -0500
commita08b12568eb7f1d1fb8bd34847461e0887b6981d (patch)
treea0d4354f50ba0df0ed8fb820170b3cd34a15b96a /src/feature/hs/hs_metrics.c
parentbc500804fde501368c8989e1118b389fa024f52e (diff)
parent3c73622f27c67eb636f19a938c5f401da8db901f (diff)
downloadtor-a08b12568eb7f1d1fb8bd34847461e0887b6981d.tar.gz
tor-a08b12568eb7f1d1fb8bd34847461e0887b6981d.zip
Merge branch 'maint-0.4.5' into maint-0.4.6
Diffstat (limited to 'src/feature/hs/hs_metrics.c')
-rw-r--r--src/feature/hs/hs_metrics.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/feature/hs/hs_metrics.c b/src/feature/hs/hs_metrics.c
index e023eab90c..891029aded 100644
--- a/src/feature/hs/hs_metrics.c
+++ b/src/feature/hs/hs_metrics.c
@@ -32,12 +32,16 @@ port_to_str(const uint16_t port)
/** Return a static buffer pointer that contains a formatted label on the form
* of key=value.
*
+ * NOTE: Important, label values MUST NOT contain double quotes else, in the
+ * case of Prometheus, it will fail with a malformed line because we force the
+ * label value to be enclosed in double quotes.
+ *
* Subsequent call to this function invalidates the previous buffer. */
static const char *
format_label(const char *key, const char *value)
{
static char buf[128];
- tor_snprintf(buf, sizeof(buf), "%s=%s", key, value);
+ tor_snprintf(buf, sizeof(buf), "%s=\"%s\"", key, value);
return buf;
}