jinho-son commented on issue #9691:
URL: https://github.com/apache/skywalking/issues/9691#issuecomment-1260451022
I think I created some confusion by using the term 'cumulative'.
The difference 'AGGREGATION_TEMPORALITY_DELTA' and
'AGGREGATION_TEMPORALITY_CUMULATIVE', is time based cumulative. (below is the
result, only different AGGREGATION_TEMPORALITY_DELTA and
AGGREGATION_TEMPORALITY_CUMULATIVE')
Using AGGREGATION_TEMPORALITY_DELTA
```
//time: t0
name: "test"
description: "description"
histogram {
data_points {
start_time_unix_nano: 1664343839851000000
time_unix_nano: 1664343899856000000
count: 1000
sum: 500500.0
bucket_counts: 10
bucket_counts: 90
bucket_counts: 400
bucket_counts: 500
bucket_counts: 0
bucket_counts: 0
bucket_counts: 0
explicit_bounds: 10.0
explicit_bounds: 100.0
explicit_bounds: 500.0
explicit_bounds: 1000.0
explicit_bounds: 1500.0
explicit_bounds: 2000.0
}
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
}
//time: t1
name: "test"
description: "description"
histogram {
data_points {
start_time_unix_nano: 1664343899856000000
time_unix_nano: 1664343959853000000
count: 1000
sum: 1500500.0
bucket_counts: 0
bucket_counts: 0
bucket_counts: 0
bucket_counts: 0
bucket_counts: 500
bucket_counts: 500
bucket_counts: 0
explicit_bounds: 10.0
explicit_bounds: 100.0
explicit_bounds: 500.0
explicit_bounds: 1000.0
explicit_bounds: 1500.0
explicit_bounds: 2000.0
}
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
}
```
Using AGGREGATION_TEMPORALITY_CUMULATIVE
```
// time:t0
name: "test"
description: "description"
histogram {
data_points {
start_time_unix_nano: 1664343663351000000
time_unix_nano: 1664343723357000000
count: 1000
sum: 500500.0
bucket_counts: 10
bucket_counts: 90
bucket_counts: 400
bucket_counts: 500
bucket_counts: 0
bucket_counts: 0
bucket_counts: 0
explicit_bounds: 10.0
explicit_bounds: 100.0
explicit_bounds: 500.0
explicit_bounds: 1000.0
explicit_bounds: 1500.0
explicit_bounds: 2000.0
}
aggregation_temporality: AGGREGATION_TEMPORALITY_CUMULATIVE
}
// time: t1
name: "test"
description: "description"
histogram {
data_points {
start_time_unix_nano: 1664343663351000000
time_unix_nano: 1664343783354000000
count: 2000
sum: 2001000.0
bucket_counts: 10
bucket_counts: 90
bucket_counts: 400
bucket_counts: 500
bucket_counts: 500
bucket_counts: 500
bucket_counts: 0
explicit_bounds: 10.0
explicit_bounds: 100.0
explicit_bounds: 500.0
explicit_bounds: 1000.0
explicit_bounds: 1500.0
explicit_bounds: 2000.0
}
aggregation_temporality: AGGREGATION_TEMPORALITY_CUMULATIVE
}
```
Why I used 'cumulative', because the process of OpenTelemetryMetricHandler
has send OpenTelemetry Metric to PrometheusConverter. and skip
AGGREGATION_TEMPORALITY_CUMULATIVE
([reason](https://github.com/apache/skywalking/issues/9691#issuecomment-1260301885))
So before send to PrometheusConverter, OpenTelemetry Histogram should change
to Prometheus histogram format, because it little be different. (If opencensus
metrics different opentelemetry)
Like this
```
final Map<Double, Long> result = new HashMap<>();
long cumulate = 0;
for (int i = 0; i < explicitBounds.size(); i++) {
cumulate += bucketCounts.get(i);
result.put(explicitBounds.get(i), cumulate);
}
result.put(Double.POSITIVE_INFINITY,
bucketCounts.get(explicitBounds.size()) + cumulate);
```
Other option,
1. Histogram Builder
2. PrometheusConverter edit convertToSample method ( if opencensus has same
issue)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]