Skip to content

Fix missing metrics due to incorrect handling of "Telemetry sampled out" responses #50256

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 23, 2025

Issue

Users experience missing metrics in Azure.Monitor.OpenTelemetry.AspNetCore when Application Insights sampling is enabled. The exporter logs errors like:

Received a partial success from ingestion. This status code is not handled and telemetry will be lost. Error StatusCode: {206}. Error Message: {Telemetry sampled out.}

This error occurs because the Azure Monitor OpenTelemetry exporter treats 206 Partial Success responses as failures when they include "Telemetry sampled out" messages, which are actually normal responses when sampling is enabled.

Changes

This PR makes three key changes to correctly handle sampled out telemetry:

  1. Added a helper method IsSamplingError() to identify when an error is due to normal sampling behavior
  2. Updated the IsSuccess() method to consider 206 (PartialSuccess) responses as successful
  3. Modified error handling to skip retry and warning logs for "Telemetry sampled out" messages

Test Results

When used with an application that has ingestion sampling enabled (like the 12.5% mentioned in the issue), metrics should now appear consistently in Application Insights without interruption due to sampling.

Customer Impact

This issue affects customers using metrics with Azure.Monitor.OpenTelemetry.AspNetCore when sampling is enabled in their Application Insights instance, causing inconsistent metrics data in dashboards and alerts.

Fixes #48141.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 4myvsblobprodcus32.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)
  • 51yvsblobprodcus36.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)
  • 5rqvsblobprodcus385.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)
  • gbsvsblobprodcus365.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)
  • nn8vsblobprodcus340.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)
  • pe3vsblobprodcus354.vsblob.vsassets.io
    • Triggering command: dotnet build sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [BUG] Missing metrics when using Azure.Monitor.OpenTelemetry due to partial success Fix missing metrics due to incorrect handling of "Telemetry sampled out" responses May 23, 2025
@Copilot Copilot AI requested a review from rajkumar-rangaraj May 23, 2025 21:48
Copilot finished work on behalf of rajkumar-rangaraj May 23, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Missing metrics when using Azure.Monitor.OpenTelemetry due to partial success
2 participants