I am implementing a SDK capable of registering telemetries in external services and as I want it to be vendor neutral, I am using OpenTelemetry. One of the exporters that I am using is the Azure Monitor Exporter to send the telemetries to Application Insight, but all the telemetries(Span, metrics, logs) from OpenTelemetry are being registered as traces type or dependency type and I would like to be able to register telemetries as Custom Events(from Application Insights).
I saw this extension for Python but wasn’t able to found a similar solution for .Net https://github.com/Azure/azure-sdk-for-python/issues/33472
I already have tried to use all the instrumentations provided by OpenTelemetry(Span, Activity, Metrics and logs).
2
Answers
Using below code I am able to register the custom events by using Open telemetry in C#.
Code:
I am able to see custom events in application insights. check below:
Output:
I found this issue on GitHub: https://github.com/Azure/azure-sdk-for-net/issues/42157
It was created on the same day as this SO question so I tempted to think that it’s the question’s author who created it.
Still, for anyone interested: based on the linked GH issue, it’s currently not possible to upload custom events with OpenTelemetry client as the OpenTelemetry specification doesn’t yet support it.
So, at the moment using ApplicationInsights SDK is the only way to track custom events.