Remove group concept from AvgHistogramFunction (#6552)
This commit is contained in:
parent
1bd397db9b
commit
af6f7d2c34
|
|
@ -50,6 +50,7 @@ Release Notes.
|
|||
* Fix tags store of log and trace on h2/mysql/pg storage.
|
||||
* Merge indices by Metrics Function and Meter Function in Elasticsearch Storage.
|
||||
* Fix receiver don't need to get itself when healthCheck
|
||||
* Remove group concept from AvgHistogramFunction. Heatmap(function result) doesn't support labels.
|
||||
|
||||
#### UI
|
||||
* Update selector scroller to show in all pages.
|
||||
|
|
|
|||
|
|
@ -21,15 +21,14 @@ package org.apache.skywalking.oap.meter.analyzer;
|
|||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.vavr.control.Try;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.skywalking.oap.meter.analyzer.dsl.SampleFamily;
|
||||
import org.apache.skywalking.oap.server.core.analysis.meter.MeterSystem;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
|
|
@ -49,9 +48,14 @@ public class MetricConvert {
|
|||
|
||||
public MetricConvert(MetricRuleConfig rule, MeterSystem service) {
|
||||
Preconditions.checkState(!Strings.isNullOrEmpty(rule.getMetricPrefix()));
|
||||
this.analyzers = rule.getMetricsRules().stream().map(r -> Analyzer.build(formatMetricName(rule, r.getName()),
|
||||
Strings.isEmpty(rule.getExpSuffix()) ? r.getExp() : String.format("(%s).%s", r.getExp(), rule.getExpSuffix()), service))
|
||||
.collect(toList());
|
||||
this.analyzers = rule.getMetricsRules().stream().map(
|
||||
r -> Analyzer.build(
|
||||
formatMetricName(rule, r.getName()),
|
||||
Strings.isEmpty(rule.getExpSuffix()) ?
|
||||
r.getExp() : String.format("(%s).%s", r.getExp(), rule.getExpSuffix()),
|
||||
service
|
||||
)
|
||||
).collect(toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.core.analysis.meter.function.avg;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
|
@ -86,17 +85,12 @@ public abstract class AvgHistogramFunction extends Metrics implements Acceptable
|
|||
|
||||
this.entityId = entity.id();
|
||||
|
||||
String template = "%s";
|
||||
if (!Strings.isNullOrEmpty(value.getGroup())) {
|
||||
template = value.getGroup() + ":%s";
|
||||
}
|
||||
final long[] values = value.getValues();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
long bucket = value.getBuckets()[i];
|
||||
String bucketName = bucket == Long.MIN_VALUE ? Bucket.INFINITE_NEGATIVE : String.valueOf(bucket);
|
||||
String key = String.format(template, bucketName);
|
||||
summation.valueAccumulation(key, values[i]);
|
||||
count.valueAccumulation(key, 1L);
|
||||
summation.valueAccumulation(bucketName, values[i]);
|
||||
count.valueAccumulation(bucketName, 1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -240,11 +240,7 @@ public class AvgHistogramFunctionTest {
|
|||
1,
|
||||
3,
|
||||
6,
|
||||
7,
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
8
|
||||
7
|
||||
}, results);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue