-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Move HTTP calls to Kibana from New() to Fetch() #15270
Conversation
This makes the `kibana/stats` metricset resilient to Kibana's unavailability.
Pinging @elastic/stack-monitoring (Stack monitoring) |
if err != nil { | ||
return nil, err | ||
if m.XPackEnabled { | ||
m.Logger().Error(err) |
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.
@ycombinator Do you really need to have a special handling of erros when xpack is enabled? My understanding is that the error will be returned by the Fetch()
method and will be logged upstream?
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.
Yes, this change was intentionally made in #12265.
In fact, I'm glad you brought this up — I need to add this same special handling around https://github.com/elastic/beats/pull/15270/files#diff-8710596f0decaae3ca552cedea1eb0a0R80 too!
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.
Oh good story about the different indices :)
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
CI failure is related to this PR:
Investigating. |
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.
Functionality LGTM!
* Move HTTP calls to Kibana from New() to Fetch() (#15270) * Move HTTP calls to Fetch() from New() This makes the `kibana/stats` metricset resilient to Kibana's unavailability. * Add special handling for errors when xpack.enabled is set to true * Don't reinit usageLastCollectedOn * Fixing up backport code to match 6.8 original code
…tic#15278) * Move HTTP calls to Fetch() from New() This makes the `kibana/stats` metricset resilient to Kibana's unavailability. * Add special handling for errors when xpack.enabled is set to true * Don't reinit usageLastCollectedOn
Resolves #15258.
This PR makes the
kibana/stats
metricset resilient to Kibana's unavailability.Before this PR, if Kibana was not already running when Metricbeat was started up with the
kibana-xpack
module enabled, Metricbeat would immediately exit with an error since Kibana was unreachable.With this PR, Metricbeat will keep running and retrying to reach Kibana periodically. This also allows Kibana to go away temporarily (say, for an upgrade) and keeps Metricbeat running.
Testing this PR
Build Metricbeat with this PR.
Enable the
kibana-xpack
module.Start up Metricbeat (without starting up Kibana).
Note that there are errors in the Metricbeat log about it not being able to connect to Kibana's stats API. But also ensure that Metricbeat keeps running.
Start up Kibana.
Check the Metricbeat log again. Ensure that eventually (< 1 minute), the connection errors go away. You may see 503 errors now; this is expected when Kibana is starting up. Ensure that eventually (< 2 minutes), the 503 errors go away as well.
Ensure that a
.monitoring-kibana-*-mb-*
index for today's date exists. Ensure that it contains recent (timestamp
within last 20 seconds) documents oftype:kibana_stats
.Stop Kibana.
Repeat steps 4-7.