Skip to content

[AzureMonitorExporter] Fix Container Apps role instance showing VM GUID instead of replica name#54586

Merged
rajkumar-rangaraj merged 3 commits intoAzure:mainfrom
rajkumar-rangaraj:rajrang/acaServiceInstance
Dec 17, 2025
Merged

[AzureMonitorExporter] Fix Container Apps role instance showing VM GUID instead of replica name#54586
rajkumar-rangaraj merged 3 commits intoAzure:mainfrom
rajkumar-rangaraj:rajrang/acaServiceInstance

Conversation

@rajkumar-rangaraj
Copy link
Copy Markdown
Member

Fixes #47424

Description

Fixes an issue where Azure Container Apps instances were showing VM instance GUIDs instead of replica names in the Role Instance field in Application Insights.

Root Cause

Azure Container Apps infrastructure runs on Azure VMs. When resource detection occurs, both the AzureVMResourceDetector and AzureContainerAppsResourceDetector detect their respective environments and set the service.instance.id attribute.

The issue occurred because the resource detectors were ordered such that the VM detector could overwrite the Container Apps replica name with a VM instance GUID.

Solution

Reordered the resource detectors to ensure AzureContainerAppsResourceDetector runs after AzureVMResourceDetector.

Testing

Tested in Azure Container Apps environment to verify replica names now appear correctly in Application Insights Role Instance field.

Copilot AI review requested due to automatic review settings December 17, 2025 22:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where Azure Container Apps instances were incorrectly showing VM instance GUIDs instead of replica names in the Application Insights Role Instance field. The fix reorders resource detectors to ensure the Container Apps detector runs after the VM detector, allowing it to override the service.instance.id attribute with the correct replica name.

  • Reordered AzureVMResourceDetector and AzureContainerAppsResourceDetector in the resource detection chain
  • Updated CHANGELOG to document the bug fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/src/OpenTelemetryBuilderExtensions.cs Swapped the order of VM and Container Apps resource detectors so Container Apps detector runs last and can override VM attributes
sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md Added changelog entry documenting the fix for Container Apps role instance display issue

Comment thread sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md Outdated
@rajkumar-rangaraj rajkumar-rangaraj merged commit 2cd4cf9 into Azure:main Dec 17, 2025
21 checks passed
This was referenced May 1, 2026
intellitect-bot pushed a commit to IntelliTect/EssentialCSharp.Web that referenced this pull request May 4, 2026
Updated
[Azure.Monitor.OpenTelemetry.AspNetCore](https://github.com/Azure/azure-sdk-for-net)
from 1.4.0 to 1.5.0.

<details>
<summary>Release notes</summary>

_Sourced from [Azure.Monitor.OpenTelemetry.AspNetCore's
releases](https://github.com/Azure/azure-sdk-for-net/releases)._

## 1.5.0

## 1.5.0 (2026-04-30)

### Features Added

* Add ability to specify EnableStandardMetrics and
EnablePerformanceCounters
  ([#​56438](Azure/azure-sdk-for-net#56438))

### Breaking Changes

* **Default Sampler Changed**: The default sampling behavior has been
changed from
`ApplicationInsightsSampler` with 100% sampling (all traces sampled) to
`RateLimitedSampler` with 5.0 traces per second. This change
significantly
reduces telemetry volume for high-traffic applications and provides
better
  cost optimization out of the box.
**Impact**: Applications with more than 5 requests per second will see
fewer
  traces exported by default.
**Migration**: To maintain the previous behavior (100% sampling),
explicitly
  configure the sampler:

  ```csharp
  // Option 1: Set SamplingRatio and clear TracesPerSecond
  builder.Services.AddOpenTelemetry()
      .UseAzureMonitor(options =>
      {
          options.SamplingRatio = 1.0f;
          options.TracesPerSecond = null;
      });
  // Option 2: Use environment variables
  // OTEL_TRACES_SAMPLER=microsoft.fixed_percentage
  // OTEL_TRACES_SAMPLER_ARG=1.0
  ```
### Bugs Fixed

* Fixed an issue where Azure Container Apps instances were showing VM
instance GUIDs
  instead of replica names in the Role Instance field.
  ([#​54586](Azure/azure-sdk-for-net#54586))


## 1.5.0-beta.1

## 1.5.0-beta.1 (2026-04-28)

### Features Added

- Upgraded api-version tag from `package-2024-05-01` to
`package-preview-2025-06`. Tag detail available at
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/appconfiguration/resource-manager/readme.md.
- Added `AzureFrontDoor` property to `AppConfigurationStoreData` and
`AppConfigurationStorePatch` to support Azure Front Door configuration
for a configuration store.
- Added new model `AppConfigurationAzureFrontDoorProperties` with a
`ResourceId` property representing an Azure Front Door profile resource
ID.


## 1.4.2

## 1.4.2 (2026-04-28)

### Other Changes

- Upgraded dependent `Azure.Core` to 1.54.0.
- Upgraded dependent `Azure.ResourceManager` to 1.14.0.


## 1.4.1

## 1.4.1 (2026-04-27)

### Other Changes

- Upgraded dependent `Azure.Core` to 1.54.0.
- Upgraded dependent `Azure.ResourceManager` to 1.14.0.


Commits viewable in [compare
view](https://github.com/Azure/azure-sdk-for-net/commits/Azure.Monitor.OpenTelemetry.AspNetCore_1.5.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Azure.Monitor.OpenTelemetry.AspNetCore&package-manager=nuget&previous-version=1.4.0&new-version=1.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Distro Monitor OpenTelemetry Distro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Container Apps role instance is not set correctly

3 participants