Skip to content

Declarative Config: Environment variable substitution breaks parsing of YAML values with mixed single and double quotes #7429

@dol

Description

@dol

Describe the bug
When using the declarative config in opentelemetry-java, the code for environment variable substitution (as per the OpenTelemetry spec and implemented via an extension of SnakeYAML) causes parsing errors for YAML values containing both single and double quotes. This occurs even if the value is not intended for environment variable substitution (i.e., it is just a regular string, not referencing an environment variable).

Steps to reproduce

  1. Use a configuration like:
resource:
  attributes:
    - name: single_quote
      value: '"single"'
    - name: double_quote
      value: "\"double\""
  1. Load this YAML file with the opentelemetry-java SDK (poc branch or main), with the environment variable substitution code present (no need to actually use environment variables in the values).

What did you expect to see?
The quoted values should be parsed as literal strings including both single and double quotes, as written.

What did you see instead?
The parser produces incorrect values (quotes missing or misinterpreted) or throws errors, even though the values are not referencing environment variables.

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