You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- common unit abbreviations are converted to Prometheus conventions (`s` -> `seconds`),
44
+
following the [collector's implementation](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/c0b51136575aa7ba89326d18edb4549e7e1bbdb9/pkg/translator/prometheus/normalize_name.go#L108)
45
+
- repeated `_` are replaced with a single `_`
46
+
- UCUM annotations (enclosed in curly braces like `{requests}`) are stripped away
47
+
- units with slash are converted e.g. `m/s` -> `meters_per_second`.
# TODO: this conflicts with the spec but I think it is correct. Need to open a spec issue
59
+
"1": "",
60
+
"%": "percent",
61
+
}
62
+
# Similar to _UNIT_MAPPINGS, but for "per" unit denominator.
63
+
# Example: s => per second (singular)
64
+
# Copied from https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/80317ce83ed87a2dff0c316bb939afbfaa823d5e/pkg/translator/prometheus/normalize_name.go#L58
65
+
_PER_UNIT_MAPPINGS= {
66
+
"s": "second",
67
+
"m": "minute",
68
+
"h": "hour",
69
+
"d": "day",
70
+
"w": "week",
71
+
"mo": "month",
72
+
"y": "year",
73
+
}
74
+
75
+
76
+
defsanitize_full_name(name: str) ->str:
77
+
"""sanitize the given metric name according to Prometheus rule, including sanitizing
0 commit comments