Skip to content

[Bug] OpenTelemetryMetricHandler Histogram buildBucket  #9691

@jinho-son

Description

@jinho-son

Search before asking

  • I had searched in the issues 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 function is bug or change it.

The process of OpenTelemetry Metric Handler is

  1. get Metrics from opentelemetry metric export
  2. change to Prometheus metric format
  3. do analyze

In step#2 send to PrometheusConverter

Prometheus Histogram Metric using 'le', but opentelemetry histogram has no 'le' using explicit_bounds, so In PrometheusConverter create 'le' through explicit bounds

In opentelemetry-proto file the histogram is boundary,

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

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

Metadata

Metadata

Assignees

Labels

backendOAP backend related.bugSomething isn't working and you are sure it's a bug!core featureCore and important feature. Sometimes, break backwards compatibility.high priorityHigh priority issue, blocking next release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions