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/transform] Allow configuring "common" statements that apply to all signals #27407

Closed
Tracked by #28644
TylerHelmuth opened this issue Oct 3, 2023 · 1 comment
Labels
Contribfest enhancement New feature or request priority:p2 Medium processor/transform Transform processor

Comments

@TylerHelmuth
Copy link
Member

TylerHelmuth commented Oct 3, 2023

Component(s)

transformprocessor

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

At the moment the resourceprocessor lets you apply resource attribute transformations with minimal config:

resource:
  attributes:
    - key: service.instance.id
       from_attribute: k8s.pod.uid
       action: insert

That configuration lets you add a new attribute named service.instance.id from the existing k8s.pod.uid attribute for traces, metrics, and logs.

The equivalent config in the transformprocessor would be

transform:
  error_mode: ignore
  trace_statements:
    - context: resource
      statements:
        - set(attributes["service.instance.id"], attributes["k8s.pod.uid"]) where attributes["service.instance.id"] == nil

  metric_statements:
    - context: resource
      statements:
        - set(attributes["service.instance.id"], attributes["k8s.pod.uid"]) where attributes["service.instance.id"] == nil
        
  log_statements:
    - context: resource
      statements:
        - set(attributes["service.instance.id"], attributes["k8s.pod.uid"]) where attributes["service.instance.id"] == nil

Although the transformprocessor can achieve the same functionality, it isn't very ergonomic.

Describe the solution you'd like

It would be nice to be able to configure some "common" statements that would be run in the resource or instrumentation scope context for each signal. Something like

transform:
  error_mode: ignore
  common_statements:
    - context: resource
      statements:
        - set(attributes["service.instance.id"], attributes["k8s.pod.uid"]) where attributes["service.instance.id"] == nil

These statements would then be added to the signal-specific statement lists. We could allow the user to specify if they should be added to the front or end of the list.

I think to start we could restrict it to resource and scope contexts, but I think there is potential here to reproduce some attributesprocessor functionality as well. A statement like set(attributes["my-attribute"], attributes["my-other-attribute"]) could be run for span, datapoint or log.

Describe alternatives you've considered

No response

Additional context

Related to #18643

@TylerHelmuth TylerHelmuth added enhancement New feature or request needs triage New item requiring triage priority:p2 Medium processor/transform Transform processor and removed needs triage New item requiring triage labels Oct 3, 2023
@TylerHelmuth
Copy link
Member Author

We had a chat about this feature at KubeCon and the outcome was that transformations should continue to be explicit for now.

Closing this for now and will take another look later.

@TylerHelmuth TylerHelmuth closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribfest enhancement New feature or request priority:p2 Medium processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

1 participant