Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processor/k8sattributes] Allow specifying that all labels/annotations should be copied #24599

Closed
TylerHelmuth opened this issue Jul 26, 2023 · 3 comments
Labels
enhancement New feature or request processor/k8sattributes k8s Attributes processor

Comments

@TylerHelmuth
Copy link
Member

TylerHelmuth commented Jul 26, 2023

Component(s)

processor/k8sattributes

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

Today the processor allows configuring which specific labels and annotations should be added as resource attributes. For users who want all the labels and/or annotations, this requires them to:

  1. Know all the possible keys
  2. List all the possible keys in the configuration

In my opinion this is a poor user experience.

Describe the solution you'd like

As a quality of life improvement I'd like to be able to specify the "Add all the labels from the pod" or "Add all the annotations from the namespace" and so on. I think the configuration API would look something like:

k8sattributes/:
 extract:
   allAnnotationsFrom:
     - pod
     - namespace
   allLabelsFrom:
     - pod 

I also don't believe this needs to be mutually exclusive from annotations and labels configuration option. Users should be allowed to use allAnnotationsFrom and annotations so that they can specify regexp extractions to get even more attributes. I does sound like a good idea to validate that if both options are used (allAnnotationsFrom and annotations or allLabelsFrom and labels) that each extraction in annotations/labels uses regexp.

@TylerHelmuth TylerHelmuth added enhancement New feature or request needs triage New item requiring triage labels Jul 26, 2023
@github-actions github-actions bot added the processor/k8sattributes k8s Attributes processor label Jul 26, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

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

@TylerHelmuth TylerHelmuth removed the needs triage New item requiring triage label Jul 26, 2023
@TylerHelmuth
Copy link
Member Author

I started work on this an then realized the current extraction logic already allows grabbing all the labels and annotations:

extract:
  labels:
    - tag_name: $$1
      key_regex: (.*)
      from: pod
    - tag_name: $$1
      key_regex: (.*)
      from: namespace
  annotations:
    - tag_name: $$1
      key_regex: (.*)
      from: pod
    - tag_name: $$1
      key_regex: (.*)
      from: namespace

It is a little more difficult than the config I proposed, but is a useable solution. Based on the ongoing filtering config work (#25128, #25135) I think we hold on this proposal for now.

@dmitryax
Copy link
Member

@TylerHelmuth this can be closed right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request processor/k8sattributes k8s Attributes processor
Projects
None yet
Development

No branches or pull requests

2 participants