Skip to content

Issue enforcing quoted values in config #10659

@MovieStoreGuy

Description

@MovieStoreGuy

Describe the bug

When providing a configuration that uses the env provider, it does not preserve the quotes around the "${env:...}".

This means when a complaint time RFC string is supplied, it gets converted into a time.Time value instead of the expected string, which then stops the config from being valid.

Steps to reproduce

  1. Set an env var with a timestamp value
    a. export BUILT_TS="2006-01-02T15:04:05Z07:00"
  2. Reference var in configuration.
    a. value : "${env:BUILT_TS}"
  3. Have collector run with configuration using reference variable.

What did you expect to see?
Considering the provider is in quotes, it should not strip those values

What did you see instead?
Upon running the collector with the provider configuration, the error is show as:

Error: failed to get config: cannot resolve the configuration: unsupported type=time.Time for retrieved config, ensure that values are wrapped in quotes

What version did you use?
v0.105.0

What config did you use?

processors:
  resource/static:
    attributes:
    - key: build.version
      action: insert
      value: "${BUILD_VERSION}"

Environment
Linux, go v1.23.4

Additional context
I've tried a few different combinations, but this currently works in v0.103.0 but upgrading to v0.105.0 surfaced this.

I've also tried:

\"${env:var}\" # Didn't work with error: retrieved value does not have unambiguous string representation: <nil>
"${env:var}"  # moved to calling the env provider directly, same error as reported

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions