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
[health] bootstrap HealthObserver from agent to API #16141
[health] bootstrap HealthObserver from agent to API #16141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making this happen. Finally, always-false-green will be really Logstash status. I have added minor suggestion and asked a question to clarify but changes are reasonable.
Can you also please take a look CI failure? It doesn't seem to me relative but not sure why failing.
@@ -28,7 +28,7 @@ def all | |||
:id => service.agent.id, | |||
:name => service.agent.name, | |||
:ephemeral_id => service.agent.ephemeral_id, | |||
:status => "green", # This is hard-coded to mirror x-pack behavior | |||
:status => service.agent.health_observer.status, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 finally...
@@ -0,0 +1,21 @@ | |||
package org.logstash.health; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not to forget adding Elastic License headers.
package org.logstash.health; | |
/* | |
* Licensed to Elasticsearch B.V. under one or more contributor | |
* license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright | |
* ownership. Elasticsearch B.V. licenses this file to you under | |
* the Apache License, Version 2.0 (the "License"); you may | |
* not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, | |
* software distributed under the License is distributed on an | |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
* KIND, either express or implied. See the License for the | |
* specific language governing permissions and limitations | |
* under the License. | |
*/ | |
package org.logstash.health; |
* @param status the other status | ||
* @return the more-degraded of the two statuses. | ||
*/ | ||
public Status reduce(Status status) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get that why we need reduce here?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of future work, and slightly out of scope but a required part of getting this endpoint bootstrapped.
Once we have many indicator reports, we will need to reduce their individual statuses into a summary status. Similar with an indicator report from many probes, each of which can degrade status.
Quality Gate passedIssues Measures |
💚 Build Succeeded
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
Release notes
[rn:skip]
What does this PR do?
org.logstash.health.HealthObserver
that is accessible viaAgent#health_observer
org.logstash.health.Status
with facilities for combining statusesstatus
withHealthObserver#status
. In bootstrap form, the value is controlled by system propertylogstash.apiStatus
, but will be derived from indicators once they are added in a subsequent PR.Why is it important/What is the impact to the user?
These are steps toward delivering the health report API as RFC'd in #16056
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files (and/or docker env variables)How to test this PR locally
To prove that the value of API response's
status
is no longer hard-coded to green,this bootstrap contains a hidden feature flag java property
logstash.apiStatus
which can be any ofunknown
,green
,yellow
,red
, orrandom
(it defaults togreen
).Start Logstash running a long-lived pipeline:
Get the API response for
GET /_node
and/orGET /_node_stats
and observe that the status is no longer hard-coded togreen
:Related issues