Skip to content

Collector does not send agent_disconnect message on SIGINT shutdown (ctrl + c) #39676

@agardnerIT

Description

@agardnerIT

Component(s)

core and/or opamp extension

What happened?

Description

The OpAMP spec states that

Steps to Reproduce

  1. Start an OpAMP server
  2. Configure a collector to connect to the server using the opamp extension
  3. Start the collector
  4. Verify that the collector has connected to the server
  5. Ctrl + C to shutdown the collector

Expected Result

After step 5, the sigint should be cause and the agent_disconnect field should be set in the AgentToServer message.

Actual Result

The collector simply stops and so the OpAMP server is left guessing at the collector status.

The last AgentToServer message I see is:

{'instanceUid': 'EjSrzYkJT+mv+bFok1FkZw==', 'sequenceNum': '4', 'capabilities': '18437', 'health': {}}

Collector version

0.121.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

extensions:
  opamp:
    server:
      # ws:
      #   endpoint: "wss://127.0.0.1:4320/v1/opamp"
      #   # Disable verification to test locally.
      #   # Don't do this in production.
      #   tls:
      #     insecure: true
      http:
        endpoint: http://127.0.0.1:4320/v1/opamp
        polling_interval: 5s
    instance_uid: "1234abcd-8909-4fe9-aff9-b16893516467" # optional
    agent_description:
      non_identifying_attributes:
        "description": "A description here..."
        "foo": "bar"
      # Feels like this should work, but doesn't
      # https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/154ba2bb62b69490d765e560d5e2534497275d21/extension/opampextension/config.go#L57C48-L57C75
      # include_resource_attributes: true
    # https://opentelemetry.io/docs/specs/opamp/#agenttoservercapabilities
    capabilities: #https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/154ba2bb62b69490d765e560d5e2534497275d21/extension/opampextension/config.go#L60
      #reports_status: true
      #accepts_remote_config: true
      #accepts_packages: true
      #reports_package_statuses: true
      #reports_own_traces: true
      #reports_own_metrics: true
      #reports_own_logs: true
      #accepts_op_amp_connection_settings: true
      #accepts_other_connection_settings: true
      reports_effective_config: true
      #accepts_restart_command: true
      reports_health: true # If agent doesn't report health, server will never learn about it
      #reports_remote_config: false
      #reports_heartbeat: true
      reports_available_components: true
      
      

receivers:
  filelog:
    include: [ file.log ]

exporters:
  debug:
    verbosity: detailed

service:
  extensions: [opamp]  # Enable the OpAMP extension
  pipelines:
    logs/blah:
      receivers: [filelog]
      processors: []
      exporters: [debug]

Log output

Additional context

No response

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