mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
**Description:**
This PR allows filtering out metrics based on resource attributes. For
example:
```
resource_attributes:
k8s.pod.name:
enabled: true
exclude:
#- strict: "kube-apiserver-kind-control-plane"
- regexp: "kube-.*"
- regexp: "coredns-.*"
- strict: "coredns"
- strict: "kindnet-mpb2p"
```
Would remove metrics that match regex or strict rules on resource
attributes.
**Link to tracking Issue:**
https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/25134
**Testing:**
- Tested with k8scluster receiver in kind cluster.
- unit tests added
**Documentation:** <Describe the documentation added.>
---------
Co-authored-by: Dmitrii Anoshin <[email protected]>
12 lines
373 B
Go
12 lines
373 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package filter // import "go.opentelemetry.io/collector/filter"
|
|
|
|
// Filter is an interface for matching values against a set of filters.
|
|
type Filter interface {
|
|
// Matches returns true if the given value matches at least one
|
|
// of the filters encapsulated by the Filter.
|
|
Matches(any) bool
|
|
}
|