Skip to content

[Resources.Azure] Add App Service account and resource group attributes - #5138

Merged
martincostello merged 4 commits into
open-telemetry:mainfrom
Lewis-E:fix-azure-app-service-resource-attributes
Aug 28, 2026
Merged

martincostello merged 4 commits into
open-telemetry:mainfrom
Lewis-E:fix-azure-app-service-resource-attributes

Conversation

@Lewis-E

@Lewis-E Lewis-E commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Update the Azure App Service resource detector to emit:

  • cloud.account.id - from WEBSITE_OWNER_NAME [sem-conv]
  • azure.resource_group.name - from WEBSITE_RESOURCE_GROUP [sem-conv]

Also include these values as params for GetAzureResourceURI instead of parsing them inside the uri function.

Goal: Align the .NET detector with the Azure App Service mapping tracked in collector-contrib #49616 and implemented for the Collector in collector-contrib #50287.

AI Disclosure: Pi Coding Agent was used to draft this PR, but I wrote this PR description and can explain all changes.

Testing

  • Unit Tests
  • Deployed a test app & verified the attributes were visible.
Screenshot 2026-08-28 at 2 19 09 PM

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-dotnet-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • Follow the OpenTelemetry Generative AI policy: disclose any AI use in your contribution, and communicate (PR descriptions, review replies) in your own words rather than AI-generated text.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help with general setup, development process, or contributor etiquette, ask in #opentelemetry-new-contributors.

@github-actions github-actions Bot added the comp:resources.azure Things related to OpenTelemetry.Resources.Azure label Aug 27, 2026
Signed-off-by: E. Lewis <7704925+Lewis-E@users.noreply.github.com>
@Lewis-E
Lewis-E force-pushed the fix-azure-app-service-resource-attributes branch from b36d7f1 to 05ea9b7 Compare August 27, 2026 19:21
Signed-off-by: E. Lewis <7704925+Lewis-E@users.noreply.github.com>
Signed-off-by: E. Lewis <7704925+Lewis-E@users.noreply.github.com>
@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.40%. Comparing base (3e219d8) to head (2e8ce7b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5138   +/-   ##
=======================================
  Coverage   78.39%   78.40%           
=======================================
  Files         497      497           
  Lines       20877    20884    +7     
=======================================
+ Hits        16367    16374    +7     
  Misses       4510     4510           
Flag Coverage Δ
unittests-Resources.Azure 84.78% <100.00%> (+0.60%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...etry.Resources.Azure/AppServiceResourceDetector.cs 93.61% <100.00%> (+1.11%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: E. Lewis <7704925+Lewis-E@users.noreply.github.com>
@martincostello

Copy link
Copy Markdown
Member

While looking at this I spotted #5143, and then in the process of looking for any further issues Claude Code noted the following with regards to this PR:

#5138 only touches App Service — it adds cloud.account.id (parsed from WEBSITE_OWNER_NAME) and azure.resource_group.name (from WEBSITE_RESOURCE_GROUP) to AppServiceResourceDetector.cs, with tests and README updates.

It does not touch:

  • AzureVMResourceDetector.cs / AzureVmMetadataResponse.cs — the Azure VM detector still doesn't emit cloud.account.id or azure.resource_group.name, even though the IMDS compute metadata includes subscriptionId and resourceGroupName fields it could parse.
  • AzureContainerAppsResourceDetector.cs — Container Apps also doesn't emit either attribute (there's no existing subscription/resource-group parsing there to build on, but the gap still applies).

Would you like to include changes for those in this PR too (or open additional PRs for those later)?

@Lewis-E

Lewis-E commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

@martincostello I was planning separate PRs for Azure Container Apps and Azure Functions, with AF soon and Azure Container Apps a while later. Would you prefer them all together? I can include Azure VMs too.

@Lewis-E
Lewis-E marked this pull request as ready for review August 28, 2026 18:55
@Lewis-E
Lewis-E requested a review from a team as a code owner August 28, 2026 18:55
@martincostello

Copy link
Copy Markdown
Member

Separate is fine - I just thought I'd mention it while it was a draft.

@martincostello
martincostello added this pull request to the merge queue Aug 28, 2026
Merged via the queue into open-telemetry:main with commit 3ff8fe2 Aug 28, 2026
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:resources.azure Things related to OpenTelemetry.Resources.Azure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants