-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Histogram<decimal> does not report values #5615
Comments
It is intentional to only support what can be reasonably represented/transported in OTLP format, which do not support decimal, without precision loss. |
I understand and yes I had to cast to double (especially in the OpenTelemetry exporter) which means a loss of precision. For financial or scientific applications it's quite common and recommended to use decimal. Is the recommended solution to keep decimal but use metrics that use double in this case? |
I am sorry, I do not have a recommendation for this yet. I was just pointing out that it was intentional to keep the supported types limited (and remove the bug tag!) If we are anyway going to lose precision in export side, is it feasible to do the decimal->double by the user when calling the API itself? |
I think it could be something feasible and could be the solution for now. As OTLP doesn't support more precision for the moment, I let you decide if you want to close this issue and the associated PR. Thank you for your feedback! |
I'd close the PR, but keep this issue open, to see if this is a common ask. Fixing this would be likely involve working with OpenTelemetry spec/proto repo, but first step is to gauge how common is this ask. |
Area
area:api
Package Version
Runtime Version
net8.0
Description
When using a
Histogram<decimal>
, values are not reported.Based on the .NET documentation,
Histogram<T>
should work withdecimal
.Steps to Reproduce
This produces the following output:
But when using a
Histogram<double>
for example, the output is:Expected Result
Values should be reported when using
Histogram<decimal>
.Actual Result
Values are not reported when using
Histogram<decimal>
.Additional Context
No response
The text was updated successfully, but these errors were encountered: