open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.9k stars 2.27k forks source link

Port k8s object receiver filters to the k8scluster receiver #31399

Open atoulme opened 6 months ago

atoulme commented 6 months ago

Component(s)

receiver/k8scluster

Is your feature request related to a problem? Please describe.

Users report they would like to selectively monitor kubernetes data, be it specific pods, namespaces.

Describe the solution you'd like

The k8sobjects receiver has a neat set of filters that seem to invite a great deal of flexibility and would be reusable with the k8s cluster receiver. The idea would be to reuse the logic and user configuration.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 6 months ago

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

TylerHelmuth commented 6 months ago

Closely related to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/25161

povilasv commented 6 months ago

@atoulme I am working on a filtering mechanism for mdatagen which would work k8sclusterreceiver too. Basically:

    receivers:
      k8s_cluster:
        collection_interval: 10s
        node_conditions_to_report: [Ready, MemoryPressure]            
        allocatable_types_to_report: [cpu, memory]                    
        resource_attributes:                                                                      
          k8s.pod.name:
            enabled: true 
            exclude:
              #- strict: "kube-apiserver-kind-control-plane"
              - regexp: "kube-.*"
              - regexp: "coredns-.*"
              - strict: "coredns"
              - strict: "kindnet-mpb2p"

Let me know if this works for you.

The PRs are:

crobert-1 commented 6 months ago

Sounds like this enhancement is supported by code owners. Implementation details are still being discussed, but we can remove needs triage.

github-actions[bot] commented 4 months ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] commented 2 months ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

povilasv commented 2 months ago

FYI filtering mechanisms landed a while back, you can now filter like this:

receivers:
  k8s_cluster:
    collection_interval: 10s
    allocatable_types_to_report: [cpu, memory]
    resource_attributes:
      k8s.namespace.name:
        metrics_exclude:
          - regexp: kube-.*
          - strict: default

Let me know if doesn't fit your use case, otherwise we can close this

github-actions[bot] commented 19 hours ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.