Fix IllegalArgumentException in PrometheusMetricConverter and NaN value samples in SampleFamily (#7349)
This commit is contained in:
parent
3704567b21
commit
bf0e22d2c1
|
|
@ -113,6 +113,8 @@ Release Notes.
|
|||
new timeout mechanism is designed for avoiding this specific case.
|
||||
* Fix Kafka transport topics are created duplicated with and without namespace issue
|
||||
* Fix possible version_conflict_engine_exception in bulk execution.
|
||||
* Fix PrometheusMetricConverter may throw an `IllegalArgumentException` when convert metrics to SampleFamily
|
||||
* Filtering NaN value samples when build SampleFamily
|
||||
|
||||
#### UI
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class SampleFamily {
|
|||
|
||||
static SampleFamily build(RunningContext ctx, Sample... samples) {
|
||||
Preconditions.checkNotNull(samples);
|
||||
samples = Arrays.stream(samples).filter(sample -> !Double.isNaN(sample.getValue())).toArray(Sample[]::new);
|
||||
Preconditions.checkArgument(samples.length > 0);
|
||||
return new SampleFamily(samples, Optional.ofNullable(ctx).orElseGet(RunningContext::instance));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class PrometheusMetricConverter {
|
|||
return metricStream
|
||||
.peek(metric -> log.debug("Prom metric to be convert to SampleFamily: {}", metric))
|
||||
.flatMap(this::convertMetric)
|
||||
.filter(t -> t != NIL)
|
||||
.filter(t -> t != NIL && t._2.samples.length > 0)
|
||||
.peek(t -> log.debug("SampleFamily: {}", t))
|
||||
.collect(toImmutableMap(Tuple2::_1, Tuple2::_2, (a, b) -> {
|
||||
log.debug("merge {} {}", a, b);
|
||||
|
|
|
|||
Loading…
Reference in New Issue