Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
a08b1256
Commit
a08b1256
authored
Feb 03, 2022
by
David Goulet
🤘
Browse files
Merge branch 'maint-0.4.5' into maint-0.4.6
parents
bc500804
3c73622f
Changes
3
Hide whitespace changes
Inline
Side-by-side
changes/ticket40552
0 → 100644
View file @
a08b1256
o Minor bugfixes (MetricsPort, Prometheus):
- Add double quotes to the label values of the onion service metrics. Fixes
bug 40552; bugfix on 0.4.5.1-alpha.
src/feature/hs/hs_metrics.c
View file @
a08b1256
...
...
@@ -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
;
}
...
...
src/test/test_metrics.c
View file @
a08b1256
...
...
@@ -30,8 +30,8 @@
#define TEST_METRICS_ENTRY_NAME "entryA"
#define TEST_METRICS_ENTRY_HELP "Description of entryA"
#define TEST_METRICS_ENTRY_LABEL_1 "label=farfadet"
#define TEST_METRICS_ENTRY_LABEL_2 "label=ponki"
#define TEST_METRICS_ENTRY_LABEL_1 "label=
\"
farfadet
\"
"
#define TEST_METRICS_ENTRY_LABEL_2 "label=
\"
ponki
\"
"
static
void
set_metrics_port
(
or_options_t
*
options
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment