Skip to content

Histogram<decimal> does not report values #5615

Description

Area

area:api

Package Version

Package Name Version
OpenTelemetry.Api 1.8.1
OpenTelemetry 1.8.1

Runtime Version

net8.0

Description

When using a Histogram<decimal>, values are not reported.

Based on the .NET documentation, Histogram<T> should work with decimal.

Steps to Reproduce

using System.Diagnostics.Metrics;
using OpenTelemetry;
using OpenTelemetry.Metrics;

using var meterProvider = Sdk.CreateMeterProviderBuilder()
    .AddMeter("TestMeter")
    .AddConsoleExporter()
    .Build();

var meter = new Meter("TestMeter");

var histogram = meter.CreateHistogram<decimal>("test-histogram");
histogram.Record(10);

This produces the following output:

Resource associated with Metric:
    telemetry.sdk.name: opentelemetry
    telemetry.sdk.language: dotnet
    telemetry.sdk.version: 1.8.1
    service.name: unknown_service:ConsoleApp1

But when using a Histogram<double> for example, the output is:

Resource associated with Metric:
    telemetry.sdk.name: opentelemetry
    telemetry.sdk.language: dotnet
    telemetry.sdk.version: 1.8.1
    service.name: unknown_service:ConsoleApp1

Metric Name: test-histogram, Meter: TestMeter
(2024-05-14T16:27:14.4076497Z, 2024-05-14T16:27:14.4159669Z] Histogram
Value: Sum: 10 Count: 1 Min: 10 Max: 10
(-Infinity,0]:0
(0,5]:0
(5,10]:1
(10,25]:0
(25,50]:0
(50,75]:0
(75,100]:0
(100,250]:0
(250,500]:0
(500,750]:0
(750,1000]:0
(1000,2500]:0
(2500,5000]:0
(5000,7500]:0
(7500,10000]:0
(10000,+Infinity]:0

Expected Result

Values should be reported when using Histogram<decimal>.

Actual Result

Values are not reported when using Histogram<decimal>.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    metricsMetrics signal relatedneeds-spec-changeIssues which require the OpenTelemetry Specification to clarify or define behaviorpkg:OpenTelemetryIssues related to OpenTelemetry NuGet packagepkg:OpenTelemetry.ApiIssues related to OpenTelemetry.Api NuGet package

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions