Skip to content

Use beat receiver subcomponent status for status translation#11856

Merged
swiatekm merged 19 commits intomainfrom
feat/beat-receiver-subcomponent-status
Jan 19, 2026
Merged

Use beat receiver subcomponent status for status translation#11856
swiatekm merged 19 commits intomainfrom
feat/beat-receiver-subcomponent-status

Conversation

@swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Dec 16, 2025

What does this PR do?

Uses subcomponent status metadata emitted by beats receivers to set unit and stream status for running components. This brings beat receiver status reporting up to par with beats processes.

As part of the implementation, I moved the otel status event serialization logic to its own package, so I can reuse it in status translation. Subcomponent statuses come in an untyped map and need to be converted to a status.Event struct before we can calculate the statuses.

This PR currently imports a patched status aggregation package from collector contrib, as the upstream PR adding the necessary functionality hasn't been merged yet. This uses our official fork and we'll have to maintain it through otel contrib upgrades until it lands and is released.

Why is it important?

Beats receivers and beats processes should be at feature parity. In particular, individual units and streams should have their status set based on the underlying beats input or module, and not based on the aggregated status of the whole receiver. If a system/metrics module emits a diagnostic message about some targets being unreachable (because they're processes owned by another uses and agent isn't running as root, for example), then this should work as expected too with beats receivers.

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 try the following config. You should see degraded statuses on the streams.

agent:
  logging:
    to_stderr: true
    level: error
  monitoring:
    enabled: false
inputs:
- data_stream:
    namespace: default
  id: unique-system-metrics-input
  streams:
  - data_stream:
      dataset: system.cpu
    metricsets:
    - cpu
    id: unique-system-metrics-input-cpu
  - data_stream:
      dataset: system.process
    metricsets:
    - process
    id: unique-system-metrics-input-process
  type: system/metrics
  use_output: default
- data_stream:
    namespace: default
  id: unique-system-metrics-input-2
  streams:
  - data_stream:
      dataset: system.cpu
    metricsets:
    - cpu
    id: unique-system-metrics-input-2-cpu
  - data_stream:
      dataset: system.process
    metricsets:
    - process
    id: unique-system-metrics-input-2-process
    degrade_on_partial: true
  type: system/metrics
  use_output: default
outputs:
  default:
    username: elastic
    password: elastic
    hosts:
    - 127.0.0.1:9200
    type: elasticsearch
    status_reporting:
      enabled: false

Related issues

@swiatekm swiatekm added bug Something isn't working backport-skip labels Dec 16, 2025
@swiatekm swiatekm added skip-changelog enhancement New feature or request and removed bug Something isn't working labels Dec 17, 2025
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch 3 times, most recently from 5107c8f to 2c4e9b0 Compare December 19, 2025 13:12
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch from f31716a to a0dd319 Compare December 22, 2025 18:29
@swiatekm swiatekm closed this Jan 5, 2026
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch from a0dd319 to 3300b7d Compare January 5, 2026 15:40
@swiatekm swiatekm reopened this Jan 5, 2026
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch from dc60a82 to aedd81a Compare January 5, 2026 16:05
@mergify
Copy link
Contributor

mergify bot commented Jan 7, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/beat-receiver-subcomponent-status upstream/feat/beat-receiver-subcomponent-status
git merge upstream/main
git push upstream feat/beat-receiver-subcomponent-status
# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go
# Conflicts:
#	go.mod
#	go.sum
#	internal/edot/go.sum
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch from aedd81a to fd1cf17 Compare January 9, 2026 09:50
@swiatekm swiatekm added backport-9.3 Automated backport to the 9.3 branch Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Jan 9, 2026
@swiatekm swiatekm marked this pull request as ready for review January 9, 2026 10:25
@swiatekm swiatekm requested a review from a team as a code owner January 9, 2026 10:25
@elasticmachine
Copy link
Contributor

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

@swiatekm swiatekm requested a review from cmacknz January 9, 2026 10:29
@mergify
Copy link
Contributor

mergify bot commented Jan 11, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/beat-receiver-subcomponent-status upstream/feat/beat-receiver-subcomponent-status
git merge upstream/main
git push upstream feat/beat-receiver-subcomponent-status
# Conflicts:
#	go.mod
@swiatekm swiatekm force-pushed the feat/beat-receiver-subcomponent-status branch from 9bceeec to 190cf65 Compare January 15, 2026 13:45
cmacknz
cmacknz previously approved these changes Jan 15, 2026
@swiatekm swiatekm requested a review from cmacknz January 19, 2026 16:00
@elasticmachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

History

cc @swiatekm

@cmacknz
Copy link
Member

cmacknz commented Jan 19, 2026

Notice needs to be updated, otherwise LGTM (again - this one is cursed apparently)

@swiatekm swiatekm enabled auto-merge (squash) January 19, 2026 18:00
@swiatekm swiatekm merged commit b3a6511 into main Jan 19, 2026
23 checks passed
@swiatekm swiatekm deleted the feat/beat-receiver-subcomponent-status branch January 19, 2026 18:24
mergify bot pushed a commit that referenced this pull request Jan 19, 2026
* Move status serialization to a separate package

# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go

* Get stream status from event attributes

* Add integration test

* Use patched healthcheckv2 extension

# Conflicts:
#	go.mod
#	go.sum
#	internal/edot/go.sum

* Fix state translation for filestream inputs without streams

* Check attributes when comparing status events

* Use the elastic collector contrib fork

* Add more comments

* Fix comments

# Conflicts:
#	go.mod

* Ensure attributes are always set in events

* Handle event attributes parsing error correctly

* mage notice

(cherry picked from commit b3a6511)
swiatekm added a commit that referenced this pull request Jan 19, 2026
…#12322)

* Move status serialization to a separate package

# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go

* Get stream status from event attributes

* Add integration test

* Use patched healthcheckv2 extension

# Conflicts:
#	go.mod
#	go.sum
#	internal/edot/go.sum

* Fix state translation for filestream inputs without streams

* Check attributes when comparing status events

* Use the elastic collector contrib fork

* Add more comments

* Fix comments

# Conflicts:
#	go.mod

* Ensure attributes are always set in events

* Handle event attributes parsing error correctly

* mage notice

(cherry picked from commit b3a6511)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
swiatekm added a commit that referenced this pull request Feb 21, 2026
Backport of the serialization refactoring from b3a6511 (PR #11856).
Moves SerializableStatus, SerializableEvent, and related types and
functions from the manager package to internal/pkg/otel/status, making
them reusable by other packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
swiatekm added a commit that referenced this pull request Feb 23, 2026
Backport of the serialization refactoring from b3a6511 (PR #11856).
Moves SerializableStatus, SerializableEvent, and related types and
functions from the manager package to internal/pkg/otel/status, making
them reusable by other packages.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.3 Automated backport to the 9.3 branch enhancement New feature or request skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

3 participants