-
Notifications
You must be signed in to change notification settings - Fork 784
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
Getting duplicate metrics being sent from azure function #5481
Comments
What you are seeing is the expected, normal behavior! It maybe surprising if you are new to Observable instruments and the concept of temporalities!
You can of course modify ObservableGauge to return nothing instead of 1, based on condition. https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.Runtime/RuntimeMetrics.cs#L117-L120 shows an example. However, OTLP/Console Exporter still exports "1" every 60 seconds!! This is the expected behavior of Cumulative temporality, which is the default in OTel. You can change temporality to Delta, by using It is bit surprising that we don't have much docs on Temporality. Part of the reason is - what temporality one should use is usually dictated by the Metrics backend! If the metrics is stored in prometheus, you'll need cumulative. If using vendor specific backends like Microsoft Azure, NewRelic, they need delta. |
I tried setting |
Switching to Delta alone won't work for ObservableInstruments. You need to modify the callback also to return empty measurement conditionally! I shared this example as a reference : Totally agree that the docs are relatively less on these aspects. https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics#example does show some examples to help understanding, which should be useful reading. |
Closing this as the question is resolved. |
#4417 can be used to track. |
I am using OTLP exporter with Azure functions to emit metrics. However, I see that duplicate metrics are being sent every minute (whatever the last value was). This keeps on going until I shut down the function app.
Here's the code for reference:
Configuration of otel with metrics
Code for meter in the function. Not the exact code for obvious reasons.
I am also using logging in the same function which works perfectly. Just for reference, I am adding it here.
TLDR:
What I want:
The text was updated successfully, but these errors were encountered: