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

[FR] Force type when doing environment variable substitution #36183

Open
flyfire2002 opened this issue Nov 4, 2024 · 1 comment
Open

[FR] Force type when doing environment variable substitution #36183

flyfire2002 opened this issue Nov 4, 2024 · 1 comment
Labels
enhancement New feature or request needs triage New item requiring triage processor/resource Resource processor

Comments

@flyfire2002
Copy link

Component(s)

processor/resource

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

When substituting env variables like "00001" (as a string) (e.g. into an attribute), the type of the produced value is automatically Int. This causes leading 0s to be stripped. (i.e. result is Int(1)) I want to be able to force it to type Str at substitution.

Describe the solution you'd like

Be able to declare type when substituting environment vars.

Describe alternatives you've considered

attribute: convert: it is done after the value is already substituted as an Int, so in this case it will be doing Int(1) => Str(1), which is still not the same as Str(00001).

Additional context

With config

  resource/common_labels:
    attributes:
    - key: some_id
      value: "${id}"
      action: upsert

When the env var id = "00001", the value of the attribute "some_id" will be Int(1).
If we do a

    - key: some_id
      action: convert
      converted_type: string

afterwards, the value is Str(1) which is still different from "00001" / Str(00001).

@flyfire2002 flyfire2002 added enhancement New feature or request needs triage New item requiring triage labels Nov 4, 2024
@github-actions github-actions bot added the processor/resource Resource processor label Nov 4, 2024
Copy link
Contributor

github-actions bot commented Nov 4, 2024

Pinging code owners:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New item requiring triage processor/resource Resource processor
Projects
None yet
Development

No branches or pull requests

1 participant