Skip to content

Commit fb5f6d7

Browse files
committed
When searching for label end start the search after the label start
This saves ~10% in the benchmark. Signed-off-by: Chris Marchbanks <[email protected]>
1 parent 09b0826 commit fb5f6d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

prometheus_client/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def _parse_sample(text):
253253
value, timestamp = _parse_value_and_timestamp(remaining_text)
254254
return Sample(name, {}, value, timestamp)
255255
name = text[:label_start].strip()
256-
label_end = _next_unquoted_char(text, '}')
256+
label_end = _next_unquoted_char(text[label_start:], '}') + label_start
257257
labels = parse_labels(text[label_start + 1:label_end], False)
258258
if not name:
259259
# Name might be in the labels

0 commit comments

Comments
 (0)