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

allow to use hash and convert on attribute values (also if retrieved from env var) #30192

Closed
cforce opened this issue Dec 23, 2023 · 6 comments
Closed
Labels
closed as inactive enhancement New feature or request needs triage New item requiring triage processor/attributes Attributes processor Stale

Comments

@cforce
Copy link

cforce commented Dec 23, 2023

Component(s)

processor/attributes

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

1.) I read and env var as attribute value and want to apply the attribute processor hash or convert method on it.
2.) I want to apply hash/convert on value(env var ) and use this new value inside a array element value of an attribute value

Describe the solution you'd like

1.)

  attributes:
    actions:
      - key: "env"
        value: "${env:DEVICEID}" 
        action: hash,upsert

2.) ${attribute:deviceid} allows to read data from attribute's namespace (even if converted or hased before) and reuse it in any substring of another value

  attributes:
    actions:
      - key: "deviceid"
        value: "${env:DEVICEID}" 
        action: hash
      - key: tags
         value: ["deviceid:${attribute:deviceid}", xxx:YYYY]
         action: upsert

Describe alternatives you've considered

None. Open for alternatives ideas

Additional context

No response

@cforce cforce added enhancement New feature or request needs triage New item requiring triage labels Dec 23, 2023
@github-actions github-actions bot added the processor/attributes Attributes processor label Dec 23, 2023
Copy link
Contributor

Pinging code owners:

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

@crobert-1
Copy link
Member

Hello @cforce, apologies for the delayed response. I'm a bit unsure what your specific request is. I believe step 1 is already possible, so is your request simply to be able to add a key:value pair to an attribute whose type is a list? Am I missing something?

@cforce
Copy link
Author

cforce commented Jan 11, 2024

I want to hash the attribute deviceid and then use the hashed attribute value of deviceid inline in another attribute tags as array element

 attributes:
    actions:
      - key: "deviceid"
        value: "${env:DEVICEID}" 
        action: hash
      - key: tags
         value: ["deviceid:${attribute:deviceid}", xxx:YYYY]
         action: upsert

@crobert-1
Copy link
Member

You can do this using the transform processor. If you're doing this on metrics you can use the datapoint context to have access to attributes (this works for traces and logs too, you just have to use the right context). The processor uses OTTL which has a hash function. You could then use an OTTL function like set or concat to add the value to your preferred destination. More information on those functions can be found here.

Copy link
Contributor

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.

Copy link
Contributor

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed as inactive enhancement New feature or request needs triage New item requiring triage processor/attributes Attributes processor Stale
Projects
None yet
Development

No branches or pull requests

2 participants