Skip to content

Commit 3240802

Browse files
committed
does this work
1 parent 88b6522 commit 3240802

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

prometheus_client/openmetrics/exposition.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#!/usr/bin/env python
2-
3-
from enum import auto, StrEnum
41
from io import StringIO
5-
from sys import maxunicode
2+
from sys import maxunicode, version_info
3+
if version_info >= (3, 11):
4+
from enum import auto, StrEnum
5+
else:
6+
from backports.strenum import auto, StrEnum
67

78
from ..utils import floatToGoString
89
from ..validation import (
@@ -130,6 +131,7 @@ def escape_metric_name(s: str, escaping: EscapingScheme) -> str:
130131
if _is_valid_legacy_metric_name(s):
131132
return s
132133
return _escape(s, escaping, False)
134+
return s
133135

134136

135137
def escape_label_name(s: str, escaping: EscapingScheme) -> str:
@@ -152,6 +154,7 @@ def escape_label_name(s: str, escaping: EscapingScheme) -> str:
152154
if _is_valid_legacy_labelname(s):
153155
return s
154156
return _escape(s, escaping, True)
157+
return s
155158

156159

157160
def _escape(s: str, escaping: EscapingScheme, is_labelname: bool) -> str:
@@ -193,6 +196,7 @@ def _escape(s: str, escaping: EscapingScheme, is_labelname: bool) -> str:
193196
escaped.write(format(ord(b), 'x'))
194197
escaped.write('_')
195198
return escaped.getvalue()
199+
return s
196200

197201

198202
def _is_valid_legacy_rune(b: str, i: int, is_labelname: bool) -> bool:

0 commit comments

Comments
 (0)