Skip to content

[cmd/components] : provider schemes in otelcol components are not printed in stable order #14476

@alexandreLamarre

Description

@alexandreLamarre

Component(s)

No response

What happened?

Describe the bug

When running the OpenTelemetry collector sub-command components:

otelcol components > components.yaml

provider schemes are not output in stable order, e.g.

#...
providers:
    - scheme: yaml
      module: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.50.0
    - scheme: env
      module: go.opentelemetry.io/collector/confmap/provider/envprovider v1.50.0
    - scheme: file
      module: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.50.0
    - scheme: http
      module: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.50.0
    - scheme: https
      module: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.50.0

or

#...
providers:
    - scheme: env
      module: go.opentelemetry.io/collector/confmap/provider/envprovider v1.50.0
    - scheme: file
      module: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.50.0
    - scheme: http
      module: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.50.0
    - scheme: https
      module: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.50.0
    - scheme: yaml
      module: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.50.0

Steps to reproduce

Download OpenTelemetryCollector default distribution, run components sub-command.
Provider schemes in the output will not be consistently printed in stable order.

What did you expect to see?

The component factories are printed in sorted order, the motivation is likely two-fold, for ease of reading for operators and for any downstream consumers of the components sub-command would want to rely on stable output here, e.g. potentially OpAmp

What did you see instead?

Provider schemes in the output were not printed in stable order, would get randomly ordered provider schemes

Collector version

v0.144.0

Environment information

Environment

N/A

OpenTelemetry Collector configuration

Log output

N/A

Additional context

N/A

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

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