-
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
[Metricbeat]Log prometheus errors instead of parsing families #15712
[Metricbeat]Log prometheus errors instead of parsing families #15712
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 so much for starting this, great improvement!
if p.logger.IsDebug() { | ||
bodyBytes, err := ioutil.ReadAll(resp.Body) | ||
if err == nil { | ||
p.logger.Debug("error received from prometheus endpoint: ", string(bodyBytes)) |
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.
do you expect this body to be large? as this error is fairly important we could consider showing it by default. With some trimming if needed
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.
don't expect large errors payloads there.
will change it to show description without debug enabled
…c#15712) * log prometheus errors instead of parsing
Solves #15709
Some users have been reporting errors fetching prometheus endpoints that include logs stating format errors decoding families.
Most probably metricbeat's prometheus helper has been trying to parse errors received as metric families. This PR adds the HTTP status code to the error sent upstream from the helper and also allows for writing the error body to log when debug is enabled.