Skip to content

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Oct 8, 2025

What does this PR do?

This PR ensures that agent-managed extensions (such as beatsauth, elastic_diagnostics, and the Agent’s internal healthcheckv2 extension) are not included in the status output, as these are internal implementation details that should not surface to users.

Key changes:

  • Added a generic filtering mechanism in handleOtelStatusUpdate to remove known agent-managed extensions (beatsauth/*, elastic_diagnostics, and agent-injected healthcheckv2) from the status tree.
  • Introduced logic to remove the agent-injected healthcheck extension from subprocess status reports while preserving user-defined ones.
  • Refactored subprocess reporting to go through a new method reportSubprocessCollectorStatus() which safely clones and publishes collector status.
    • Added a deep clone helper (cloneCollectorStatus) to prevent mutation races on shared status references between the collector and reporting goroutines.
  • Adjusted unit tests to verify:
    • Managed extensions are hidden from the reported status.
    • User-defined healthcheck extensions remain visible.
    • No race conditions occur when mutating collector status during reporting.

Why is it important?

Previously, all OTel extensions - including agent internal ones - were always visible in elastic-agent status output.
This caused confusion and clutter in the status tree, exposing implementation details irrelevant to users.

By filtering out agent-managed extensions and cloning the status tree before reporting, this change ensures cleaner, more user-focused status output.

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

Disruptive User Impact

Since a release with otel runtime enabled by default is not yet published there is no disruptive user impact

How to test this PR locally

mage unitTest

Related issues

N/A

@pkoutsovasilis pkoutsovasilis self-assigned this Oct 8, 2025
@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch backport-9.2 Automated backport to the 9.2 branch labels Oct 8, 2025
@pkoutsovasilis pkoutsovasilis force-pushed the fix/hide_managed_extensions_status branch from af2827a to 9e7efc7 Compare October 8, 2025 11:30
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review October 8, 2025 17:02
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner October 8, 2025 17:02
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @pkoutsovasilis

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@pkoutsovasilis pkoutsovasilis merged commit d8f1dae into elastic:main Oct 9, 2025
21 checks passed
mergify bot pushed a commit that referenced this pull request Oct 9, 2025
* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)

# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go
#	internal/pkg/otel/manager/manager.go
mergify bot pushed a commit that referenced this pull request Oct 9, 2025
* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)

# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go
#	internal/pkg/otel/manager/manager.go
#	internal/pkg/otel/manager/manager_test.go
mergify bot pushed a commit that referenced this pull request Oct 9, 2025
* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)
pkoutsovasilis added a commit that referenced this pull request Oct 9, 2025
…10451)

* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)

Co-authored-by: Panos Koutsovasilis <[email protected]>
swiatekm pushed a commit that referenced this pull request Oct 10, 2025
* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test
pkoutsovasilis added a commit that referenced this pull request Oct 14, 2025
* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)

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

# Conflicts:
#	internal/pkg/otel/manager/execution_subprocess.go
pkoutsovasilis added a commit that referenced this pull request Oct 15, 2025
…ions statuses (#10449)

* fix: do not report agent managed otel extensions statuses (#10412)

* fix: do not report agent managed extensions statuses

* fix: clone reported collector status for subprocess to avoid mutations to the internal currentStatus ref

* fix: unit-test race conditions

* fix: typo and actually assign collectorMetricsPort in unit-test

(cherry picked from commit d8f1dae)

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

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

* fix: resolve conflicts

* fix: wrong rebase

* fix: wrong rebase pt2

* Use require.EventuallyWithT

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
Co-authored-by: Shaunak Kashyap <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch backport-9.2 Automated backport to the 9.2 branch skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[beats receivers] Extension status is always present in status output in otel mode

4 participants