Skip to content

[cmd/opampsupervisor] Supervisor starts agent with invalid default config #38794

Closed
@bacherfl

Description

@bacherfl

Component(s)

cmd/opampsupervisor

What happened?

Description

The OpAMP supervisor currently attempts to start the agent with a config that is missing a pipeline, which leads to the agent process shutting down immediately, due to the invalid config. Subsequently, the supervisor attempts to start the process again periodically, with the same config.

I believe this happens because in the composeMergedConfig() function, there is a check if the message from the server contains at least one config:

configMapIsEmpty := len(config.GetConfig().GetConfigMap()) == 0

If the length of that map is 0, the supervisor creates the noop config containing the minimal config for the collector to run.

However it seems like there is always an empty instance config in the message from the server, which is then skipped later: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/opampsupervisor/supervisor/supervisor.go#L1120-L1126

This will then result in the following config in the produced effective.yaml:

extensions:
    health_check:
        endpoint: localhost:65191
    opamp:
        capabilities:
            reports_available_components: false
        instance_uid: 01933f61-49d0-70f6-acc7-9da8ae71e609
        ppid: 61985
        ppid_poll_interval: 5s
        server:
            ws:
                endpoint: ws://127.0.0.1:65194/v1/opamp
                tls:
                    insecure: true
service:
    extensions:
        - health_check
        - opamp
    telemetry:
        logs:
            encoding: json
        metrics:
            readers:
                - periodic:
                    exporter:
                        otlp:
                            endpoint: http://localhost:4318/v1/metrics
                            protocol: http/protobuf
        resource:
            host.arch: arm64
            host.name: host
            os.description: macOS 15.3.2
            os.type: darwin
            service.instance.id: 01933f61-49d0-70f6-acc7-9da8ae71e609
            service.name: otelcontribcol
            service.version: 0.121.1-dev

Steps to Reproduce

Follow the setup described in the [README}(https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/opampsupervisor/README.md#experimenting-with-the-supervisor)

Expected Result

The collector agent process is either started with a noop pipeline, or not started until a valid configuration has been sent by the OpAMP server

Actual Result

Until a valid configuration is sent by the OpAMP server, the agent process periodically get started and shuts down

Collector version

0.121.1

Environment information

Environment

OS: macOS 15.3.2
Compiler(if manually compiled): go v1.23.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions