Skip to content

Commit 19f122f

Browse files
committed
Prometheus core metrics collector: Do not render any sampels that are NaN or undefined
close #8740
1 parent 66052e0 commit 19f122f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,15 @@ mf_totals(Callback, Name, Type, Help, Size) ->
391391
)
392392
).
393393

394+
has_value_p('NaN') ->
395+
false;
396+
has_value_p(undefined) ->
397+
false;
398+
has_value_p(_) ->
399+
true.
400+
394401
collect_metrics(_, {Type, Fun, Items}) ->
395-
[metric(Type, labels(Item), Fun(Item)) || Item <- Items].
402+
[metric(Type, labels(Item), V) || {Item, V} <- [{Item, Fun(Item)} || Item <- Items], has_value_p(V)].
396403

397404
labels(Item) ->
398405
label(element(1, Item)).

0 commit comments

Comments
 (0)