OpenTelemetry and Azure Monitor Exporter support#578
OpenTelemetry and Azure Monitor Exporter support#578rossgrambo wants to merge 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for using OpenTelemetry with Azure Monitor Exporter as an alternative to Application Insights for feature flag telemetry. The implementation uses structured logging instead of direct TelemetryClient calls, making it more flexible and aligned with modern .NET logging patterns.
Key changes:
- New
Microsoft.FeatureManagement.Telemetry.AzureMonitorpackage with OpenTelemetry-based telemetry - New test project
Tests.FeatureManagement.Telemetry.AzureMonitorwith comprehensive test coverage - New example application
VariantAndAzureMonitorDemodemonstrating the usage
Reviewed changes
Copilot reviewed 38 out of 91 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Microsoft.FeatureManagement.Telemetry.AzureMonitor/*.cs |
Core implementation of Azure Monitor telemetry using OpenTelemetry processors and structured logging |
src/Microsoft.FeatureManagement.Telemetry.AzureMonitor/*.csproj |
Package configuration with OpenTelemetry dependencies |
tests/Tests.FeatureManagement.Telemetry.AzureMonitor/*.cs |
Test suite covering telemetry logging and processor ordering |
examples/VariantAndAzureMonitorDemo/* |
Demo application showing migration from Application Insights to Azure Monitor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Tests.FeatureManagement.Telemetry.AzureMonitor/ProcessorOrderTests.cs
Outdated
Show resolved
Hide resolved
tests/Tests.FeatureManagement.Telemetry.AzureMonitor/ProcessorOrderTests.cs
Outdated
Show resolved
Hide resolved
tests/Tests.FeatureManagement.Telemetry.AzureMonitor/ProcessorOrderTests.cs
Outdated
Show resolved
Hide resolved
...AndAzureMonitorDemo/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js
Show resolved
Hide resolved
| return; | ||
| } | ||
|
|
||
| string targetingId = activity.Baggage.FirstOrDefault(t => t.Key == TargetingIdKey).Value; |
There was a problem hiding this comment.
Based on https://opentelemetry.io/docs/specs/semconv/feature-flags/feature-flags-events/#evaluation-event shouldn't this value already be a tag hence u could use that instead of baggage
| /// <summary> | ||
| /// Listens to <see cref="Activity"/> events from feature management and sends them to Azure Monitor via structured logging. | ||
| /// </summary> | ||
| internal sealed class AzureMonitorEventPublisher : IDisposable |
There was a problem hiding this comment.
Wouldn't it be easier to implement this as otel processor/exporter?
| return; | ||
| } | ||
|
|
||
| string targetingId = Activity.Current?.Baggage.FirstOrDefault(t => t.Key == TargetingIdKey).Value; |
There was a problem hiding this comment.
Based on https://opentelemetry.io/docs/specs/semconv/feature-flags/feature-flags-events/#evaluation-event shouldn't this value already be a tag hence u could use that instead of baggage
Why this PR?
This change adds support for using OpenTelemetry with Azure Monitor Exporter instead of Application Insights.
Visible Changes
Microsoft.FeatureManagement.Telemetry.AzureMonitor. This package looks very similar toMicrosoft.FeatureManagement.Telemetry.ApplicationInsightsand works similarly.VariantAndAzureMonitorDemo. It is a clone of VariantAndTelemetry demo but uses OTel and Azure Monitor.Migrating from .ApplicationInsights to .AzureMonitor
Package
Builder extension
Emitting events
*Note: Even better, use High-performance logging, like the
LoggerExtension.csin the example.