From a9183c246ceb897b527a2069eb581ccb58b4c40a Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:09:56 -0600 Subject: [PATCH] [collector] Use ottl in filterprocessor example (#4145) --- .../docs/collector/transforming-telemetry.md | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/content/en/docs/collector/transforming-telemetry.md b/content/en/docs/collector/transforming-telemetry.md index 2139548264d9..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 @@ -23,38 +23,35 @@ 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"] != "app3" ``` -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 `service1` 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"] == "service1" ``` The