open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.73k stars 2.16k forks source link

The "extension" configuration item of the configuration file is overwritten #32050

Open mike9421 opened 3 months ago

mike9421 commented 3 months ago

Component(s)

cmd/opampsupervisor

What happened?

Description

When I delivered the remote configuration through the OpAMP sample server, I found that the extension in the final configuration of OTEL was cleared, leaving only health_check.

Steps to Reproduce

  1. Fill in the correct configuration to ensure that the opampsupervisor can connect to the backend normally
  2. Start the backend OpAMP sample server
  3. Start opampsupervisor
  4. Deliver remote configuration through OpAMP UI
  5. Check the otel configuration displayed by the OpAMP UI or view the local file named effective.yaml

    Expected Result

    The extension component I added is not cleared, at most health_check is added

    Actual Result

    The extension component I added was cleared

Collector version

all

Environment information

OS: Darwin Compiler: go 1.21

OpenTelemetry Collector configuration

receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: otel-collector
          scrape_interval: 10s
          static_configs:
            - targets:
              - 0.0.0.0:55149
exporters:
  otlphttp:
    endpoint: http://localhost:4318/v1/metrics
extensions:
  pprof:
  memory_ballast:
    size_mib: "256"
service:
  pipelines:
    metrics:
      exporters:
        - otlphttp
      receivers:
        - prometheus
  extensions:
    - memory_ballast
    - pprof

Log output

No response

Additional context

I know that the extensions configuration item is overwritten in this code. The fundamental reason is that koanf cannot parse extensions into key-value form, so the previous value will be overwritten. I think we can solve this problem by adding configuration items to extensions instead of executing koanf.merge directly.

github-actions[bot] commented 3 months ago

Pinging code owners:

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

evan-bradley commented 2 months ago

Thanks for opening this. You're right, this is currently an issue due to the way the Collector's underlying conf library merges lists. A potential fix in the Collector has been documented here: https://github.com/open-telemetry/opentelemetry-collector/issues/8754. For now, I have an open PR that will introduce a fix for the Supervisor in the meantime: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31641

github-actions[bot] commented 2 weeks ago

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.