Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 4, 2025

What does this PR do?

Fix a bug where Elastic Agent would enter a failed state if components were running as beats receivers and the otel collector also had an extension defined via hybrid mode.

The result would be the following agent status:

┌─ fleet
│  └─ status: (STOPPED) Not enrolled into Fleet
└─ elastic-agent
   ├─ status: (FAILED) OTel manager failed: pipeline status id extensions is not a pipeline
   ├─ extensions
   │  ├─ status: StatusOK
   │  └─ extension:health_check/v2
   │     └─ status: StatusOK

Why is it important?

We should report status for otel extensions correctly.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

How to test this PR locally

Build agent locally and run it with the following configuration:

outputs:
  default:
    type: elasticsearch
    hosts: [127.0.0.1:9200]
    username: "elastic"
    password: ""

agent:
  monitoring:
    enabled: true
    _runtime_experimental: otel

inputs: []

# Embedded Otel configuration
receivers:
  nop:
exporters:
  nop:
extensions:
  health_check/v2:
service:
  extensions: [health_check/v2]
  pipelines:
    logs:
      receivers: [nop]
      exporters: [nop]

Then run elastic-agent status. You should see the extension status and the statuses of monitoring components:

┌─ fleet
│  └─ status: (STOPPED) Not enrolled into Fleet
└─ elastic-agent
   ├─ status: (DEGRADED) 1 or more components/units in a degraded state
   ├─ beat/metrics-monitoring
   │  ├─ status: (DEGRADED) DEGRADED
   │  └─ beat/metrics-monitoring
   │     └─ status: (DEGRADED) Elasticsearch request failed: dial tcp 127.0.0.1:9200: connect: connection refused
   ├─ filestream-monitoring
   │  ├─ status: (DEGRADED) DEGRADED
   │  └─ filestream-monitoring
   │     └─ status: (DEGRADED) Elasticsearch request failed: dial tcp 127.0.0.1:9200: connect: connection refused
   ├─ http/metrics-monitoring
   │  ├─ status: (DEGRADED) DEGRADED
   │  └─ http/metrics-monitoring
   │     └─ status: (DEGRADED) Elasticsearch request failed: dial tcp 127.0.0.1:9200: connect: connection refused
   ├─ extensions
   │  ├─ status: StatusOK
   │  └─ extension:health_check/v2
   │     └─ status: StatusOK
   └─ pipeline:logs
      ├─ status: StatusOK
      ├─ exporter:nop
      │  └─ status: StatusOK
      └─ receiver:nop
         └─ status: StatusOK

Related issues


This is an automatic backport of pull request #8696 done by [Mergify](https://mergify.com).

* Fix otel extension status reporting

* Explicitly handle errors from otel status id parsing

(cherry picked from commit de39cae)
@mergify mergify bot added the backport label Jul 4, 2025
@mergify mergify bot requested a review from a team as a code owner July 4, 2025 13:21
@mergify mergify bot requested review from pchila and ycombinator and removed request for a team July 4, 2025 13:21
@github-actions github-actions bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog labels Jul 4, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@swiatekm swiatekm enabled auto-merge (squash) July 4, 2025 13:29
@elastic-sonarqube
Copy link

@swiatekm swiatekm merged commit c490a7b into 8.19 Jul 4, 2025
21 checks passed
@swiatekm swiatekm deleted the mergify/bp/8.19/pr-8696 branch July 4, 2025 15:09
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @swiatekm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants