Support process Sum metrics with AGGREGATION_TEMPORALITY_DELTA case (#10410)
This commit is contained in:
parent
eda83dca93
commit
155d231111
|
|
@ -98,6 +98,7 @@
|
|||
* Migrate tests from junit 4 to junit 5.
|
||||
* Refactor http-based alarm plugins and extract common logic to `HttpAlarmCallback`.
|
||||
* Support Amazon Simple Storage Service (Amazon S3) metrics monitoring
|
||||
* Support process Sum metrics with AGGREGATION_TEMPORALITY_DELTA case
|
||||
|
||||
#### UI
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ import org.apache.skywalking.oap.server.library.util.prometheus.metrics.Metric;
|
|||
import org.apache.skywalking.oap.server.library.util.prometheus.metrics.Summary;
|
||||
import org.apache.skywalking.oap.server.receiver.otel.OtelMetricReceiverConfig;
|
||||
|
||||
import static io.opentelemetry.proto.metrics.v1.AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE;
|
||||
import static io.opentelemetry.proto.metrics.v1.AggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;
|
||||
import static io.opentelemetry.proto.metrics.v1.AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
|
|
@ -180,9 +181,23 @@ public class OpenTelemetryMetricRequestProcessor implements Service {
|
|||
if (metric.hasSum()) {
|
||||
final Sum sum = metric.getSum();
|
||||
if (sum
|
||||
.getAggregationTemporality() != AGGREGATION_TEMPORALITY_CUMULATIVE) {
|
||||
.getAggregationTemporality() == AGGREGATION_TEMPORALITY_UNSPECIFIED) {
|
||||
return Stream.empty();
|
||||
}
|
||||
if (sum
|
||||
.getAggregationTemporality() == AGGREGATION_TEMPORALITY_DELTA) {
|
||||
return sum.getDataPointsList().stream()
|
||||
.map(point -> new Gauge(
|
||||
metric.getName(),
|
||||
mergeLabels(
|
||||
nodeLabels,
|
||||
buildLabels(point.getAttributesList())
|
||||
),
|
||||
point.hasAsDouble() ? point.getAsDouble()
|
||||
: point.getAsInt(),
|
||||
point.getTimeUnixNano() / 1000000
|
||||
));
|
||||
}
|
||||
if (sum.getIsMonotonic()) {
|
||||
return sum.getDataPointsList().stream()
|
||||
.map(point -> new Counter(
|
||||
|
|
|
|||
Loading…
Reference in New Issue