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

Regression: Error message for duplicate keys in configuration #12000

Open
tsloughter opened this issue Dec 31, 2024 · 0 comments
Open

Regression: Error message for duplicate keys in configuration #12000

tsloughter opened this issue Dec 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tsloughter
Copy link
Member

Describe the bug

A duplicate key in the configuration like this duplicate use of http:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "0.0.0.0:4317"
      http:
        endpoint: "0.0.0.0:4318"
      http:
        cors:
          allowed_origins:
          - "http://localhost:8000"
        endpoint: "0.0.0.0:4318"

when run with main results in the error message:

$ bin/otelcorecol_linux_amd64 --config ../roll_dice_gleam/otel-collector-config.yaml
Error: failed to get config: cannot resolve the configuration: retrieved value (type=string) cannot be used as a Conf
2024/12/31 10:58:11 collector server run finished with error: failed to get config: cannot resolve the configuration: retrieved value (type=string) cannot be used as a Conf

This makes no mention of where the issue in the file was found or that it was a duplicate key.

Compare to what the error message was as of commit 334d95aebcffc88fa19ac4233dc166dd51aaa55f:

Error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: yaml: unmarshal errors:
  line 9: mapping key "http" already defined at line 7
2024/12/31 10:53:08 collector server run finished with error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: yaml: unmarshal errors:
  line 9: mapping key "http" already defined at line 7

The line number and the key http was given and that it was a duplicate issue.

Steps to reproduce

Run a recent collector with the configuration like the above.

What did you expect to see?

The previous error message as shown above.

What did you see instead?

An error message that does not give details on the actual issue.

What version did you use?

does't work: ffcef93
works: 334d95a

What config did you use?

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "0.0.0.0:4317"
      http:
        endpoint: "0.0.0.0:4318"
      http:
        cors:
          allowed_origins:
          - "http://localhost:8000"
        endpoint: "0.0.0.0:4318"

exporters:
  debug:
    verbosity: detailed
    sampling_initial: 1
    sampling_thereafter: 1

  pipelines:
    traces:
      receivers: [otlp]
      processors: [h]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      processors: []
      exporters: [debug]
    logs:
      receivers: [otlp]
      processors: [batch]
      exporters: [debug]

Environment

Fedora 41
Go 1.22.0

@tsloughter tsloughter added the bug Something isn't working label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant