File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/OpenTelemetry.Exporter.Console Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -146,8 +146,21 @@ public override ExportResult Export(in Batch<Metric> batch)
146146 }
147147 else
148148 {
149- // TODO: Consider how/if to display buckets for exponential histograms.
150- bucketsBuilder . AppendLine ( "Buckets are not displayed for exponential histograms." ) ;
149+ var exponentialHistogramData = metricPoint . GetExponentialHistogramData ( ) ;
150+ var scale = exponentialHistogramData . Scale ;
151+
152+ if ( exponentialHistogramData . ZeroCount != 0 )
153+ {
154+ bucketsBuilder . AppendLine ( $ "Zero Bucket:{ exponentialHistogramData . ZeroCount } ") ;
155+ }
156+
157+ var offset = exponentialHistogramData . PositiveBuckets . Offset ;
158+ foreach ( var bucketCount in exponentialHistogramData . PositiveBuckets )
159+ {
160+ var lowerBound = Base2ExponentialBucketHistogram . LowerBoundary ( offset , scale ) . ToString ( CultureInfo . InvariantCulture ) ;
161+ var upperBound = Base2ExponentialBucketHistogram . LowerBoundary ( ++ offset , scale ) . ToString ( CultureInfo . InvariantCulture ) ;
162+ bucketsBuilder . AppendLine ( $ "({ lowerBound } , { upperBound } ]:{ bucketCount } ") ;
163+ }
151164 }
152165
153166 valueDisplay = bucketsBuilder . ToString ( ) ;
Original file line number Diff line number Diff line change 2828 <Compile Include =" $(RepoRoot)\src\OpenTelemetry\Internal\OpenTelemetrySdkEventSource.cs" Link =" Includes\OpenTelemetrySdkEventSource.cs" />
2929 <Compile Include =" $(RepoRoot)\src\OpenTelemetry\Internal\PeriodicExportingMetricReaderHelper.cs" Link =" Includes\PeriodicExportingMetricReaderHelper.cs" />
3030 <Compile Include =" $(RepoRoot)\src\OpenTelemetry\Internal\TagTransformer.cs" Link =" Includes\TagTransformer.cs" />
31+ <Compile Include =" $(RepoRoot)\src\OpenTelemetry\Metrics\Base2ExponentialBucketHistogram.LowerBoundary.cs" Link =" Includes\Base2ExponentialBucketHistogram.LowerBoundary.cs" />
3132 <Compile Include =" $(RepoRoot)\src\OpenTelemetry.Api\Internal\ExceptionExtensions.cs" Link =" Includes\ExceptionExtensions.cs" />
3233 <Compile Include =" $(RepoRoot)\src\OpenTelemetry.Api\Internal\Guard.cs" Link =" Includes\Guard.cs" />
3334 <Compile Include =" $(RepoRoot)\src\OpenTelemetry.Api\Internal\SpanAttributeConstants.cs" Link =" Includes\SpanAttributeConstants.cs" />
You can’t perform that action at this time.
0 commit comments