The Aspire dashboard does not show any data points when using Exponential Histograms. It will show the metric within the dashboard, but nothing will be plotted on the graph.
Failing code:
// See https://aka.ms/new-console-template for more information
using System.Diagnostics.Metrics;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using var meter = new Meter("TestMeter", "1.0.0");
var providerBuilder = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(r => r.AddService("testservice"))
.AddMeter(meter.Name); // All instruments from this meter are enabled.
// Use Exponential Histogram
providerBuilder.AddView(
instrument => instrument.GetType().GetGenericTypeDefinition() == typeof(Histogram<>)
? new Base2ExponentialBucketHistogramConfiguration()
: null
);
providerBuilder.AddOtlpExporter();
var provider = providerBuilder.Build();
while (true)
{
await Task.Delay(TimeSpan.FromSeconds(1));
meter.CreateHistogram<long>("foo").Record(1);
}
Working code (using fixed bucket histogram)
// See https://aka.ms/new-console-template for more information
using System.Diagnostics.Metrics;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using var meter = new Meter("TestMeter", "1.0.0");
var providerBuilder = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(r => r.AddService("testservice"))
.AddMeter(meter.Name); // All instruments from this meter are enabled.
providerBuilder.AddOtlpExporter();
var provider = providerBuilder.Build();
while (true)
{
await Task.Delay(TimeSpan.FromSeconds(1));
meter.CreateHistogram<long>("foo").Record(1);
}
The Aspire dashboard does not show any data points when using Exponential Histograms. It will show the metric within the dashboard, but nothing will be plotted on the graph.
Failing code:
Working code (using fixed bucket histogram)