Skip to content

Cherry-pick to 7.0: Ignore prometheus metrics when their values are NaN or Inf (#12084)#12286

Merged
kaiyan-sheng merged 2 commits intoelastic:7.0from
kaiyan-sheng:backport_12084_7.0
May 27, 2019
Merged

Cherry-pick to 7.0: Ignore prometheus metrics when their values are NaN or Inf (#12084)#12286
kaiyan-sheng merged 2 commits intoelastic:7.0from
kaiyan-sheng:backport_12084_7.0

Conversation

@kaiyan-sheng
Copy link
Copy Markdown
Contributor

@kaiyan-sheng kaiyan-sheng commented May 24, 2019

Cherry-pick of PR #12084 to 7.0 branch. Original message:

When prometheus report metrics with value NaN or +Inf or -Inf, metricbeat will fail with error like "Failed to serialize the event: unsupported float value: NaN". This PR is to add the logic to ignore prometheus metrics with NaN/Inf value in collector metricset.

This PR also added a metrics-with-naninf.plain test data with NaN/Inf as metric value. From the output metrics-with-naninf.plain-expected.json you can see, the metrics with NaN/Inf value are not there.

(cherry picked from commit 9244477)

kaiyan-sheng added 2 commits May 24, 2019 15:32
* Ignore prometheus metrics when their values are NaN or Inf
* Avoid NaN/Inf in prometheus helper
* Add checks on Gauge, Summary and Counter
* Add NaN/Inf check on histogram values

(cherry picked from commit 9244477)
@kaiyan-sheng kaiyan-sheng requested review from a team as code owners May 24, 2019 21:34
@kaiyan-sheng kaiyan-sheng self-assigned this May 24, 2019
@kaiyan-sheng kaiyan-sheng merged commit f88fe9c into elastic:7.0 May 27, 2019
@kaiyan-sheng kaiyan-sheng deleted the backport_12084_7.0 branch May 27, 2019 14:32
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…aN or Inf (elastic#12084) (elastic#12286)

* Ignore prometheus metrics when their values are NaN or Inf (elastic#12084)

* Ignore prometheus metrics when their values are NaN or Inf
* Avoid NaN/Inf in prometheus helper
* Add checks on Gauge, Summary and Counter
* Add NaN/Inf check on histogram values

(cherry picked from commit 6810e31)

* Fix changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants