You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Azure Monitor exporter to export metrics using the OTLP exporter, the customMetrics showing up in application insights always have value: 0.
Steps to Reproduce
Can be reproduced by taking measurements (e.g. from a counter) in a .NET application:
using OpenTelemetry;using OpenTelemetry.Metrics;using System.Diagnostics.Metrics;namespace Test;publicclassProgram{privatestaticreadonlyMeterMyMeter=new("Test","1.0");privatestaticreadonlyCounter<long>MyFruitCounter= MyMeter.CreateCounter<long>("MyFruitCounter");publicstaticvoidMain(){usingvarmeterProvider= Sdk.CreateMeterProviderBuilder().AddMeter("Test").AddOtlpExporter().AddConsoleExporter().Build();
MyFruitCounter.Add(10,new("name","apple"),new("color","red"));}}
Expected Result
As per the above example, the value field should be 10 (given a valueCount of 1).
Actual Result
The value, valueMin, valueMax and valueSum fields are all 0:
The console exporter on the test application displays the value to be 10, which is correct:
Resource associated with Metric:
service.name: unknown_service:dotnet
Export MyFruitCounter, Meter: Test/1.0
(2023-02-24T09:54:09.9409890Z, 2023-02-24T09:54:10.1143793Z] color: red name: apple LongSum
Value: 10
Any IntValue() will be discarded, which might be why for the above sample code (which uses Counter<long>) the value in Application Insights is 0. If wanted, I can work on a fix for this.
bastbu
changed the title
Azure Monitor exporter exports metric values always as 0 for counter measurements
Azure Monitor exporter exports metric values always as 0 for long counter measurements
Feb 24, 2023
Component(s)
exporter/azuremonitor
What happened?
Description
When using the Azure Monitor exporter to export metrics using the OTLP exporter, the
customMetrics
showing up in application insights always havevalue: 0
.Steps to Reproduce
Can be reproduced by taking measurements (e.g. from a counter) in a .NET application:
Expected Result
As per the above example, the
value
field should be10
(given avalueCount
of 1).Actual Result
The
value
,valueMin
,valueMax
andvalueSum
fields are all0
:The console exporter on the test application displays the value to be
10
, which is correct:Collector version
0.72.0
Environment information
Environment
OS: WSL2 on Windows 11
OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: