Hey everyone! I've been setting up distributed tracing using Azure Monitor and OpenTelemetry, and I just found out that Microsoft added support for OpenTelemetry with the `AddAzureMonitor()` extension in .NET. However, this only allows for head-based sampling, and I'm looking into tail-based sampling options since it seems to be possible only through the OpenTelemetry collector with the `azuremonitorexporter`, even though Microsoft doesn't officially support this package. Are there any alternatives out there for implementing tail-based sampling?
4 Answers
Using the OpenTelemetry collector with the Azure Monitor exporter lets you handle tail sampling and send telemetry to Azure. I've used it for my work projects, and it’s been solid overall!
I wouldn't worry too much about that! The OpenTelemetry team actively supports and maintains the collector, which might even be a better option. Since Application Insights is compatible with OpenTelemetry, you should be fine using it!
I see your point, but I’m just hesitant since, even though Microsoft contributes a lot to the OpenTelemetry community, them not supporting this package makes me wary.
Another option to consider is using Grafana's adaptive telemetry which supports tail sampling as well. You can find more about it in their documentation.
You could try implementing your own sampling logic by filtering based on spans. Check the Microsoft docs on filtering OpenTelemetry in Application Insights. You can set `activity.IsAllDataRequested` or `IsRecording` to filter out telemetry as needed, and you can even check the parent span's properties for more control.

That sounds great! How do you host your OpenTelemetry collector?