Skip to content

Commit 19bcc8e

Browse files
committed
docs[open-telemetry]: Add new and future translation strategies for Otel metric name translation.
Signed-off-by: Owen Williams <[email protected]>
1 parent b282978 commit 19bcc8e

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

content/docs/guides/opentelemetry.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ By default, the OTLP receiver is disabled, similarly to the Remote Write receive
1212
This is because Prometheus can work without any authentication, so it would not be
1313
safe to accept incoming traffic unless explicitly configured.
1414

15-
To enable the receiver you need to toggle the CLI flag `--web.enable-otlp-receiver`.
16-
This will cause Prometheus to serve OTLP metrics receiving on HTTP `/api/v1/otlp/v1/metrics` path.
15+
To enable the receiver you need to toggle the CLI flag `--web.enable-otlp-receiver`.
16+
This will cause Prometheus to serve OTLP metrics receiving on HTTP `/api/v1/otlp/v1/metrics` path.
1717

1818
```shell
1919
$ prometheus --web.enable-otlp-receiver
@@ -147,16 +147,19 @@ For each of a resource's OTel metrics, Prometheus converts it to a corresponding
147147
148148
## UTF-8
149149
150-
From the 3.x version, Prometheus supports UTF-8 for metric names and labels, so [Prometheus normalization translator package from OpenTelemetry](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus) can be omitted.
150+
From the 3.x version, Prometheus supports UTF-8 for metric names and labels, so [Prometheus normalization translator package from OpenTelemetry](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus) can be omitted. Note that when Prometheus announces through content negotiation that it allows UTF-8 characters, this does not require that metric names contain previously-unsupported characters. The OTLP metrics may be converted in several different ways, depending on the configuration of the endpoint. So while UTF-8 is enabled by default in Prometheus storage and UI, you need to set the `translation_strategy` for OTLP metrics receiver, which by default is set to old normalization `UnderscoreEscapingWithSuffixes`.
151151
152-
UTF-8 is enabled by default in Prometheus storage and UI, but you need to `translation_strategy` for OTLP metric receiver, which by default is set to old normalization `UnderscoreEscapingWithSuffixes`.
152+
There are four possible translation strategies, two of which require UTF-8 support to be enabled in Prometheus:
153153
154-
Setting it to `NoUTF8EscapingWithSuffixes`, which we recommend, will disable changing special characters to `_` which allows native use of OpenTelemetry metric format, especially with [the semantic conventions](https://opentelemetry.io/docs/specs/semconv/general/metrics/). Note that special suffixes like units and `_total` for counters will be attached. There is [ongoing work to have no suffix generation](https://github.com/prometheus/proposals/pull/39), stay tuned for that.
154+
* `UnderscoreEscapingWithSuffixes`, the default. This fully escapes metric names for classic Prometheus metric name compatibility, and includes appending type and unit suffixes.
155+
* `NoUTF8EscapingWithSuffixes` will disable changing special characters to `_` which allows native use of OpenTelemetry metric format, especially with [the semantic conventions](https://opentelemetry.io/docs/specs/semconv/general/metrics/). Note that special suffixes like units and `_total` for counters will be attached to prevent possible collisions with multiple metrics of the same name having different type or units. This mode requires UTF-8 to be enabled.
156+
* Coming soon: `UnderscoreEscapingWithoutSuffixes`, which will change special characters to `_` but not append suffixes. This mode will not be available until [Type and Unit metadata](https://github.com/prometheus/proposals/blob/main/proposals/2024-09-25_metadata-labels.md) is supported in Prometheus.
157+
* `NoTranslation`. This strategy bypasses all metric and label name translation, passing them through unaltered. This mode requires UTF-8 to be enabled.
155158
156159
```
157160
otlp:
158161
# Ingest OTLP data keeping UTF-8 characters in metric/label names.
159-
translation_strategy: NoUTF8EscapingWithSuffixes
162+
translation_strategy: NoTranslation
160163
```
161164
162165
## Delta Temporality

content/docs/guides/utf8.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ support UTF-8.
1414

1515
This document guides you through the UTF-8 transition details.
1616

17-
# Go Instrumentation
17+
# Go Instrumentation
1818

1919
Currently, metrics created by the official Prometheus [client_golang library](https://github.com/prometheus/client_golang) will reject UTF-8 names
2020
by default. It is necessary to change the default validation scheme to allow
@@ -82,6 +82,14 @@ setting the `escaping` header to a different value.
8282
underscores are replaced with double underscores. This mode allows for full
8383
round-tripping of UTF-8 names with a legacy system.
8484

85+
Enabling UTF-8 support in Prometheus indicates that the system is *capable* of
86+
receiving UTF-8 characters, but does not require that metric names contain
87+
previously-unsupported characters. Nor does an Accept header announcing support
88+
for UTF-8 require that the metrics producer disable name translation on their
89+
end. The choice of exact name translation strategy is up to the metrics
90+
producer. The requirement is that when a system requests an escaping scheme
91+
other than allow-utf-8, the producer convert the names in the manner requested.
92+
8593
## Remote Write 2.0
8694

8795
Remote Write 2.0 automatically accepts all UTF-8 names in Prometheus 3.0. There

0 commit comments

Comments
 (0)