From 9eae6d336edb5f72be7568f0d118b81ddf8abe6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Wed, 4 Dec 2024 10:58:38 +0100 Subject: [PATCH 1/2] feat(docs/otel): describe keep_identifying_resource_attributes option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up to https://github.com/prometheus/prometheus/pull/15448 Signed-off-by: György Krajcsovits --- content/docs/guides/opentelemetry.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/docs/guides/opentelemetry.md b/content/docs/guides/opentelemetry.md index ba2f1d3e7..6e9fdcdc0 100644 --- a/content/docs/guides/opentelemetry.md +++ b/content/docs/guides/opentelemetry.md @@ -130,6 +130,14 @@ So, what is the relation between the `target_info` metric and OTel resource attr When Prometheus processes an OTLP write request, and provided that contained resources include the attributes `service.instance.id` and/or `service.name`, Prometheus generates the info metric `target_info` for every (OTel) resource. It adds to each such `target_info` series the label `instance` with the value of the `service.instance.id` resource attribute, and the label `job` with the value of the `service.name` resource attribute. If the resource attribute `service.namespace` exists, it's prefixed to the `job` label value (i.e., `/`). + +By default `service.name`, `service.namespace` and `service.instance.id` themselves are not added to `target_info`, because they are converted into `job` and `instance`. However the following configuration parameter can be enabled to add them to `target_info` directly (possibly going through normalization to replace dots with underscores) on top of the conversion into `job` and `instance`. + +``` +otlp: + keep_identifying_resource_attributes: true +``` + The rest of the resource attributes are also added as labels to the `target_info` series, names converted to Prometheus format (e.g. dots converted to underscores). If a resource lacks both `service.instance.id` and `service.name` attributes, no corresponding `target_info` series is generated. From 6c8783389f04f6256bf62d0d7f96a665d272e4e4 Mon Sep 17 00:00:00 2001 From: George Krajcsovits Date: Wed, 4 Dec 2024 11:11:41 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Arve Knudsen Signed-off-by: George Krajcsovits --- content/docs/guides/opentelemetry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/guides/opentelemetry.md b/content/docs/guides/opentelemetry.md index 6e9fdcdc0..7b7dbf3a9 100644 --- a/content/docs/guides/opentelemetry.md +++ b/content/docs/guides/opentelemetry.md @@ -131,14 +131,14 @@ When Prometheus processes an OTLP write request, and provided that contained res It adds to each such `target_info` series the label `instance` with the value of the `service.instance.id` resource attribute, and the label `job` with the value of the `service.name` resource attribute. If the resource attribute `service.namespace` exists, it's prefixed to the `job` label value (i.e., `/`). -By default `service.name`, `service.namespace` and `service.instance.id` themselves are not added to `target_info`, because they are converted into `job` and `instance`. However the following configuration parameter can be enabled to add them to `target_info` directly (possibly going through normalization to replace dots with underscores) on top of the conversion into `job` and `instance`. +By default `service.name`, `service.namespace` and `service.instance.id` themselves are not added to `target_info`, because they are converted into `job` and `instance`. However the following configuration parameter can be enabled to add them to `target_info` directly (going through normalization to replace dots with underscores, if `otlp.translation_strategy` is `UnderscoreEscapingWithSuffixes`) on top of the conversion into `job` and `instance`. ``` otlp: keep_identifying_resource_attributes: true ``` -The rest of the resource attributes are also added as labels to the `target_info` series, names converted to Prometheus format (e.g. dots converted to underscores). +The rest of the resource attributes are also added as labels to the `target_info` series, names converted to Prometheus format (e.g. dots converted to underscores) if `otlp.translation_strategy` is `UnderscoreEscapingWithSuffixes`. If a resource lacks both `service.instance.id` and `service.name` attributes, no corresponding `target_info` series is generated. For each of a resource's OTel metrics, Prometheus converts it to a corresponding Prometheus time series, and (if `target_info` is generated) adds the right `instance` and `job` labels.