Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Oct 30, 2024

Proposed commit message

Fix Node and container resource limit metrics missing intermittently.

This is a bug very recently introduced by the refactor in #41216. Metadata watchers are not just responsible for updating metadata, but also Node and container metrics. Only updating the latter eagerly when metadata is requested leads to races, where the values may be missing depending on the order in which metrics are fetched.

This fix decouples metrics calculation from metadata calculation. Metrics now have their own handlers attached to the watcher, and are completely detached from metadata enrichers. I don't like the resulting architecture that much, as it concentrates a lot of logic in the watcher. But it is an improvement over the status quo, and I'd like to fix this bug promptly before we release it to users.

The bug was quite difficult to catch in E2E tests, as it could take some time to appear. I've tested this change much more carefully, and haven't seen any issues after hours of running it in my test cluster.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

Simplest way is to install elastic-agent standalone and look at the default Kubernetes dashboard.

Related issues


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

…41453)

* Fix Pod and container resource limit metrics missing intermittently

* Add another exception to typecheck linter

(cherry picked from commit e7cc6fc)
@mergify mergify bot requested a review from a team as a code owner October 30, 2024 15:18
@mergify mergify bot added the backport label Oct 30, 2024
@mergify mergify bot requested a review from a team as a code owner October 30, 2024 15:18
@mergify mergify bot requested review from constanca-m and gizas and removed request for a team October 30, 2024 15:18
@mergify mergify bot requested review from VihasMakwana and faec and removed request for a team October 30, 2024 15:18
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 30, 2024
@botelastic
Copy link

botelastic bot commented Oct 30, 2024

This pull request doesn't have a Team:<team> label.

@pierrehilbert pierrehilbert merged commit 4e7aaa6 into 8.15 Oct 30, 2024
@pierrehilbert pierrehilbert deleted the mergify/bp/8.15/pr-41453 branch October 30, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport needs_team Indicates that the issue/PR needs a Team:* label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants