jinho-son opened a new issue, #9691:
URL: https://github.com/apache/skywalking/issues/9691

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   OAP server (apache/skywalking)
   
   ### What happened
   
   When using OpenTelemetry Histogram metric it not working correctly
   
   ### What you expected to happen
   
   The metrics generate from opentelemetry client will be same result.
   
   ### How to reproduce
   
   Use default application.yaml 
   
   the opentelemetry client (java) create DoubleHistogram, and record 1 ~ 1000.
   total count is 1000, and sum is 500500
   ```
   Metric #0
   Descriptor:
        -> Name: test
        -> Description: 
        -> Unit: 
        -> DataType: Histogram
        -> AggregationTemporality: AGGREGATION_TEMPORALITY_CUMULATIVE
   HistogramDataPoints #0
   StartTimestamp: 2022-09-27 04:41:01.914 +0000 UTC
   Timestamp: 2022-09-27 04:42:01.921 +0000 UTC
   Count: 1000
   Sum: 500500.000000
   ExplicitBounds #0: 5.000000
   ExplicitBounds #1: 10.000000
   ExplicitBounds #2: 25.000000
   ExplicitBounds #3: 50.000000
   ExplicitBounds #4: 75.000000
   ExplicitBounds #5: 100.000000
   ExplicitBounds #6: 250.000000
   ExplicitBounds #7: 500.000000
   ExplicitBounds #8: 750.000000
   ExplicitBounds #9: 1000.000000
   ExplicitBounds #10: 2500.000000
   ExplicitBounds #11: 5000.000000
   ExplicitBounds #12: 7500.000000
   ExplicitBounds #13: 10000.000000
   Buckets #0, Count: 5
   Buckets #1, Count: 5
   Buckets #2, Count: 15
   Buckets #3, Count: 25
   Buckets #4, Count: 25
   Buckets #5, Count: 25
   Buckets #6, Count: 150
   Buckets #7, Count: 250
   Buckets #8, Count: 250
   Buckets #9, Count: 250
   Buckets #10, Count: 0
   Buckets #11, Count: 0
   Buckets #12, Count: 0
   Buckets #13, Count: 0
   Buckets #14, Count: 0
   ```
   
   ### Anything else
   
   I think [OpenTelemetry Metric Handler 
buildBucket](https://github.com/apache/skywalking/blob/master/oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/otlp/OpenTelemetryMetricHandler.java#L155)
 function is bug or change it.
   
   The process of [OpenTelemetry Metric 
Handler](https://github.com/apache/skywalking/blob/master/oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/otlp/OpenTelemetryMetricHandler.java)
 is
   1. get Metrics from opentelemetry metric export
   2. change to Prometheus metric format
   3. do analyze
   
   In step#2 send to 
[PrometheusConverter](https://github.com/apache/skywalking/blob/bf4cf9d8a026b82693066719c1607eb79d35a844/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/prometheus/PrometheusMetricConverter.java#L57)
   
   Prometheus Histogram Metric using 'le', but opentelemetry histogram has no 
'le' using 
[explicit_bounds](https://github.com/apache/skywalking/blob/master/oap-server/server-receiver-plugin/receiver-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto#L441),
 so In PrometheusConverter create 'le' through explicit bounds
   
   In opentelemetry-proto file the histogram is 
[boundary](https://github.com/apache/skywalking/blob/master/oap-server/server-receiver-plugin/receiver-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto#L433),
   
   opentelemetry like
   0 ~ 100 : 20
   100 ~ 200 : 30
   200 ~ 300 : 10
   300 ~ +Inf : 0
   
   but prometheus like
   le 100 : 20
   le 200 : 50
   le 300 : 60
   
   The problem occurs when [SampleFamily histogram 
method](https://github.com/apache/skywalking/blob/bf4cf9d8a026b82693066719c1607eb79d35a844/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java#L408)
   
   I think it will be change to opentelemetry histogram build bucket method to 
cumulative.
   
   Am I misunderstood opentelemetry-proto file?
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to