Skip to content

Commit beca06c

Browse files
authored
Clarify the NoUTF8EscapingWithSuffixes and UnderscoreEscapingWithSuffixes modes (prometheus#15567)
Signed-off-by: Arve Knudsen <[email protected]>
1 parent ac4f8a5 commit beca06c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Diff for: config/config.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -1427,10 +1427,13 @@ func getGoGCEnv() int {
14271427
type translationStrategyOption string
14281428

14291429
var (
1430-
// NoUTF8EscapingWithSuffixes will keep UTF-8 characters as they are, units and type suffixes will still be added.
1430+
// NoUTF8EscapingWithSuffixes will accept metric/label names as they are.
1431+
// Unit and type suffixes may be added to metric names, according to certain rules.
14311432
NoUTF8EscapingWithSuffixes translationStrategyOption = "NoUTF8EscapingWithSuffixes"
14321433
// UnderscoreEscapingWithSuffixes is the default option for translating OTLP to Prometheus.
1433-
// This option will translate all UTF-8 characters to underscores, while adding units and type suffixes.
1434+
// This option will translate metric name characters that are not alphanumerics/underscores/colons to underscores,
1435+
// and label name characters that are not alphanumerics/underscores to underscores.
1436+
// Unit and type suffixes may be appended to metric names, according to certain rules.
14341437
UnderscoreEscapingWithSuffixes translationStrategyOption = "UnderscoreEscapingWithSuffixes"
14351438
)
14361439

Diff for: docs/configuration/configuration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ otlp:
179179
# - "UnderscoreEscapingWithSuffixes" refers to commonly agreed normalization used
180180
# by OpenTelemetry in https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus
181181
# - "NoUTF8EscapingWithSuffixes" is a mode that relies on UTF-8 support in Prometheus.
182-
# It preserves all special characters like dots, but it still add required suffixes
183-
# for units and _total like in UnderscoreEscapingWithSuffixes.
182+
# It preserves all special characters like dots, but still adds required metric name suffixes
183+
# for units and _total, as UnderscoreEscapingWithSuffixes does.
184184
[ translation_strategy: <string> | default = "UnderscoreEscapingWithSuffixes" ]
185185
# Enables adding "service.name", "service.namespace" and "service.instance.id"
186186
# resource attributes to the "target_info" metric, on top of converting

Diff for: documentation/examples/prometheus-otlp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ otlp:
2222
- k8s.pod.name
2323
- k8s.replicaset.name
2424
- k8s.statefulset.name
25-
# Ingest OTLP data keeping UTF-8 characters in metric/label names.
25+
# Ingest OTLP data keeping all characters in metric/label names.
2626
translation_strategy: NoUTF8EscapingWithSuffixes
2727

2828
storage:

0 commit comments

Comments
 (0)