Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[taskManager plugin status] Do not emit empty status to status Observables #171012

Merged

Conversation

gsoldevila
Copy link
Contributor

@gsoldevila gsoldevila commented Nov 10, 2023

Summary

Improvement over #169447, see related comment.

@gsoldevila gsoldevila added bug Fixes for quality problems that affect the customer experience backport:skip This commit does not require backporting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Nov 10, 2023
@@ -16,12 +16,12 @@ export function calculateHealthStatus(
config: TaskManagerConfig,
shouldRunTasks: boolean,
logger: Logger
): { status: HealthStatus; reason?: string } {
): { status: HealthStatus; reason?: string; isEmpty?: boolean } {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe instead of isEmpty, we could just have a new HealthStatus.NOT_INITIALIZED and filter on that instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds like a great idea!

@@ -114,7 +115,8 @@ export function healthRoute(params: HealthRouteParams): {
}),
// Only calculate the summarized stats (calculates all running averages and evaluates state)
// when needed by throttling down to the requiredHotStatsFreshness
map((stats) => withServiceStatus(getHealthStatus(stats)))
map((stats) => withServiceStatus(getHealthStatus(stats))),
filter(([monitoredHealth]) => !monitoredHealth.isEmpty)
Copy link
Contributor Author

@gsoldevila gsoldevila Nov 10, 2023

Choose a reason for hiding this comment

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

@ymao1 I haven't checked the impact of filtering at this level, i.e. whether we want the monitoredHealth$ observable to have the "NOT_INITIALIZED" events.

There's also a call to logHealthMetrics, but I imagine logging the "NOT_INITIALIZED" does not bring much value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the code, all the subscribers to the observable are trying to pull various stats from the monitoredHealth$.stats which would be empty anyway in this case, so I believe the impact is small. I'm unable to run it locally right now (poor internet connection) but will give it a go first thing next week.

@gsoldevila gsoldevila marked this pull request as ready for review November 13, 2023 09:30
@gsoldevila gsoldevila requested a review from a team as a code owner November 13, 2023 09:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@gsoldevila gsoldevila added the release_note:skip Skip the PR/issue when compiling release notes label Nov 13, 2023
Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks again for fixing

@gsoldevila gsoldevila requested a review from a team as a code owner November 13, 2023 16:20
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@gsoldevila gsoldevila merged commit 33ba491 into elastic:main Nov 14, 2023
gsoldevila added a commit that referenced this pull request Nov 15, 2023
## Summary

Address #171164

The tests were assuming that the first event emitted is always
`"degraded"`.
After merging #171012 this might
no longer be the case, aka the first event might already have an
`"available"` status and we might have no more events in that case.

This PR takes this enhancement into account and makes the test more
robust:
* Checking that an `"initializing"` event comes through first.
* Checking that we eventually get an `"available"` event.

---

Flaky Test Runner Pipeline - 100x 🟢 
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting bug Fixes for quality problems that affect the customer experience Feature:Task Manager release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants