Skip to content

[Resources.AWS] Add host.image.id for EC2 - #5110

Open
martincostello wants to merge 1 commit into
open-telemetry:mainfrom
martincostello:gh-1516
Open

[Resources.AWS] Add host.image.id for EC2#5110
martincostello wants to merge 1 commit into
open-telemetry:mainfrom
martincostello:gh-1516

Conversation

@martincostello

Copy link
Copy Markdown
Member

Contributes to #1516

Changes

Add the recommended host.image.id attribute to the AWS EC2 resource detector.

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)

Add `host.image.id` to the AWS EC2 resource detector.

Contributes to open-telemetry#1516.
@github-actions github-actions Bot added the comp:resources.aws Things related to OpenTelemetry.Resources.AWS label Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.90%. Comparing base (cd0365a) to head (8faacfb).
⚠️ Report is 20 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5110      +/-   ##
==========================================
- Coverage   77.97%   77.90%   -0.08%     
==========================================
  Files         477      477              
  Lines       20395    20396       +1     
==========================================
- Hits        15904    15890      -14     
- Misses       4491     4506      +15     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 88.49% <ø> (ø)
unittests-DynamicControl 100.00% <ø> (ø)
unittests-Exporter.Geneva 56.40% <ø> (-0.38%) ⬇️
unittests-Exporter.InfluxDB 97.96% <ø> (ø)
unittests-Exporter.OneCollector 95.60% <ø> (ø)
unittests-Extensions 95.77% <ø> (ø)
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Extensions.Enrichment.AspNetCore 86.27% <ø> (ø)
unittests-Extensions.Enrichment.Http 94.33% <ø> (ø)
unittests-Instrumentation.AWS 85.35% <ø> (ø)
unittests-Instrumentation.AspNet 79.15% <ø> (ø)
unittests-Instrumentation.AspNetCore 87.20% <ø> (ø)
unittests-Instrumentation.Cassandra 92.30% <ø> (ø)
unittests-Instrumentation.ConfluentKafka 83.42% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.36% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 81.02% <ø> (ø)
unittests-Instrumentation.EventCounters 76.31% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.12% <ø> (ø)
unittests-Instrumentation.GrpcNetClient 78.30% <ø> (ø)
unittests-Instrumentation.Hangfire 88.88% <ø> (ø)
unittests-Instrumentation.Http 76.00% <ø> (ø)
unittests-Instrumentation.Kusto 92.44% <ø> (ø)
unittests-Instrumentation.Owin 89.15% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 77.77% <ø> (ø)
unittests-Instrumentation.Remoting 65.59% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 39.91% <ø> (ø)
unittests-Instrumentation.SqlClient 84.88% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 94.98% <ø> (ø)
unittests-Instrumentation.Wcf 82.64% <ø> (ø)
unittests-OpAmp.Client 87.05% <ø> (+0.44%) ⬆️
unittests-PersistentStorage 69.20% <ø> (ø)
unittests-Resources.AWS 72.88% <100.00%> (+0.09%) ⬆️
unittests-Resources.Azure 84.18% <ø> (ø)
unittests-Resources.Container 80.76% <ø> (ø)
unittests-Resources.Gcp 80.70% <ø> (ø)
unittests-Resources.Host 72.34% <ø> (ø)
unittests-Resources.OperatingSystem 77.16% <ø> (ø)
unittests-Resources.Process 90.90% <ø> (ø)
unittests-Resources.ProcessRuntime 80.76% <ø> (ø)
unittests-Sampler.AWS 96.05% <ø> (ø)

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

Files with missing lines Coverage Δ
src/OpenTelemetry.Resources.AWS/AWSEC2Detector.cs 70.27% <100.00%> (+0.82%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the recommended host.image.id resource attribute to the AWS EC2 detector using the AMI ID from the instance identity document.

Changes:

  • Deserializes and emits the EC2 imageId.
  • Updates semantic conventions, tests, documentation, and changelog.

Reviewed changes

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

Show a summary per file
File Description
test/OpenTelemetry.Resources.AWS.Tests/SampleAWSEC2IdentityDocumentModel.cs Adds sample image ID data.
test/OpenTelemetry.Resources.AWS.Tests/AWSEC2DetectorTests.cs Verifies deserialization and emitted attribute.
src/Shared/AWS/AWSSemanticConventions.Legacy.cs Defines the legacy attribute key.
src/Shared/AWS/AWSSemanticConventions.cs Adds the attribute builder method.
src/Shared/AWS/AWSSemanticConventions.Base.cs Adds the base semantic-convention property.
src/OpenTelemetry.Resources.AWS/README.md Documents the new EC2 metadata.
src/OpenTelemetry.Resources.AWS/Models/AWSEC2IdentityDocumentModel.cs Maps the EC2 imageId field.
src/OpenTelemetry.Resources.AWS/CHANGELOG.md Records the behavioral change.
src/OpenTelemetry.Resources.AWS/AWSEC2Detector.cs Emits host.image.id.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@martincostello
martincostello marked this pull request as ready for review August 22, 2026 16:10
@martincostello
martincostello requested a review from a team as a code owner August 22, 2026 16:10
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 22, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-09-01 07:14 UTC

Merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@martincostello martincostello added the keep-open Prevents issues and pull requests being closed as stale label Aug 29, 2026
@Kielek
Kielek disabled auto-merge September 1, 2026 06:40
@Kielek

Kielek commented Sep 1, 2026

Copy link
Copy Markdown
Member

LGTM, but I would wait for some review from AWS component owners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:resources.aws Things related to OpenTelemetry.Resources.AWS keep-open Prevents issues and pull requests being closed as stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants