From db55bc2916100f3493d09910e7ec42fab7d4434d Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:26:21 -0600 Subject: [PATCH 1/4] Use ottl in filterprocessor example --- .../docs/collector/transforming-telemetry.md | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/content/en/docs/collector/transforming-telemetry.md b/content/en/docs/collector/transforming-telemetry.md index 2139548264d9..530cb4253c29 100644 --- a/content/en/docs/collector/transforming-telemetry.md +++ b/content/en/docs/collector/transforming-telemetry.md @@ -23,38 +23,33 @@ a significant impact on collector performance. **Processor**: [filter processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor) -The filter processor allows users to filter telemetry based on `include` or -`exclude` rules. Include rules are used for defining "allow lists" where -anything that does _not_ match include rules is dropped from the collector. -Exclude rules are used for defining "deny lists" where telemetry that matches -rules is dropped from the collector. +The filter processor allows users to filter telemetry using [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md). Telemetry that matches any condition is dropped. For example, to _only_ allow span data from services app1, app2, and app3 and drop data from all other services: ```yaml processors: - filter/allowlist: - spans: - include: - match_type: strict - services: - - app1 - - app2 - - app3 + filter/ottl: + error_mode: ignore + traces: + span: + - | + resource.attributes["service.name"] != "app1" and + resource.attributes["service.name"] != "app2" and + resource.attributes["service.name"] != "app2" ``` -To only block spans from a service called development while allowing all other -spans, an exclude rule is used: +To only drop spans from a service called development while keeping all other +spans: ```yaml processors: - filter/denylist: - spans: - exclude: - match_type: strict - services: - - development + filter/ottl: + error_mode: ignore + traces: + span: + - resource.attributes["service.name"] == "development" ``` The From 26cb292846f4a15b6cd0c8601638ddf21265da6d Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:30:41 -0600 Subject: [PATCH 2/4] npm run fix --- content/en/docs/collector/transforming-telemetry.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/en/docs/collector/transforming-telemetry.md b/content/en/docs/collector/transforming-telemetry.md index 530cb4253c29..4ff63858cb95 100644 --- a/content/en/docs/collector/transforming-telemetry.md +++ b/content/en/docs/collector/transforming-telemetry.md @@ -23,7 +23,9 @@ a significant impact on collector performance. **Processor**: [filter processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor) -The filter processor allows users to filter telemetry using [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md). Telemetry that matches any condition is dropped. +The filter processor allows users to filter telemetry using +[OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md). +Telemetry that matches any condition is dropped. For example, to _only_ allow span data from services app1, app2, and app3 and drop data from all other services: @@ -35,8 +37,8 @@ processors: traces: span: - | - resource.attributes["service.name"] != "app1" and - resource.attributes["service.name"] != "app2" and + resource.attributes["service.name"] != "app1" and + resource.attributes["service.name"] != "app2" and resource.attributes["service.name"] != "app2" ``` From bc88730a55506f6b60b1acc7495b038bf41c732a Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:20:25 -0600 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- content/en/docs/collector/transforming-telemetry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/collector/transforming-telemetry.md b/content/en/docs/collector/transforming-telemetry.md index 4ff63858cb95..86c58ef850cb 100644 --- a/content/en/docs/collector/transforming-telemetry.md +++ b/content/en/docs/collector/transforming-telemetry.md @@ -42,7 +42,7 @@ processors: resource.attributes["service.name"] != "app2" ``` -To only drop spans from a service called development while keeping all other +To only drop spans from a service called `service1` while keeping all other spans: ```yaml @@ -51,7 +51,7 @@ processors: error_mode: ignore traces: span: - - resource.attributes["service.name"] == "development" + - resource.attributes["service.name"] == "service1" ``` The From 677bc38140e3dc33144efbdfa6f6733be26a7f59 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:32:43 -0600 Subject: [PATCH 4/4] add ottl to spell ignore --- content/en/docs/collector/transforming-telemetry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/collector/transforming-telemetry.md b/content/en/docs/collector/transforming-telemetry.md index 86c58ef850cb..7cc4473b0283 100644 --- a/content/en/docs/collector/transforming-telemetry.md +++ b/content/en/docs/collector/transforming-telemetry.md @@ -2,7 +2,7 @@ title: Transforming telemetry weight: 26 # prettier-ignore -cSpell:ignore: accountid clustername k8sattributes metricstransform resourcedetection +cSpell:ignore: accountid clustername k8sattributes metricstransform OTTL resourcedetection --- The OpenTelemetry Collector is a convenient place to transform data before @@ -39,7 +39,7 @@ processors: - | resource.attributes["service.name"] != "app1" and resource.attributes["service.name"] != "app2" and - resource.attributes["service.name"] != "app2" + resource.attributes["service.name"] != "app3" ``` To only drop spans from a service called `service1` while keeping all other