Skip to content

Commit

Permalink
[collector] Use ottl in filterprocessor example (#4145)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth authored Mar 13, 2024
1 parent ce21faa commit a9183c2
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions content/en/docs/collector/transforming-telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a9183c2

Please sign in to comment.