Skip to content

Conversation

@martincostello
Copy link
Member

Changes

Split out the implementation in [EnabledOnDockerPlatformTheory] to allow for a [EnabledOnDockerPlatformFact].

Cherry-picked from #3015.

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)

Copilot AI review requested due to automatic review settings August 22, 2025 08:28
@martincostello martincostello requested a review from a team as a code owner August 22, 2025 08:28
@github-actions github-actions bot requested a review from matt-hensley August 22, 2025 08:28
@github-actions github-actions bot added comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient labels Aug 22, 2025
Copy link
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 refactors Docker platform detection logic by extracting common functionality into reusable helper classes and creating a new [EnabledOnDockerPlatformFact] attribute alongside the existing [EnabledOnDockerPlatformTheory] attribute.

  • Extract Docker detection logic into a shared DockerHelper class
  • Create new EnabledOnDockerPlatformFactAttribute for single test scenarios
  • Move DockerPlatform enum to a separate file for better organization

Reviewed Changes

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

Show a summary per file
File Description
test/Shared/EnabledOnDockerPlatformTheoryAttribute.cs Refactored to use the new DockerHelper instead of inline Docker detection logic
test/Shared/EnabledOnDockerPlatformFactAttribute.cs New attribute for Fact tests that need Docker platform validation
test/Shared/DockerPlatform.cs Extracted enum to separate file for better code organization
test/Shared/DockerHelper.cs New helper class containing the Docker platform detection logic
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientIntegrationTests.cs Updated attribute reference and simplified assertion
test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj Added references to new shared files
test/OpenTelemetry.Instrumentation.EntityFrameworkCore.Tests/OpenTelemetry.Instrumentation.EntityFrameworkCore.Tests.csproj Added references to new shared files
test/OpenTelemetry.Instrumentation.EntityFrameworkCore.Tests/EntityFrameworkIntegrationTests.cs Updated attribute reference

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

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

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3028      +/-   ##
==========================================
- Coverage   69.61%   69.60%   -0.02%     
==========================================
  Files         413      413              
  Lines       16203    16207       +4     
==========================================
+ Hits        11280    11281       +1     
- Misses       4923     4926       +3     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 87.36% <ø> (ø)
unittests-Exporter.Geneva 53.33% <ø> (ø)
unittests-Exporter.InfluxDB 95.14% <ø> (ø)
unittests-Exporter.Instana 74.86% <ø> (ø)
unittests-Exporter.OneCollector 94.61% <ø> (ø)
unittests-Extensions 90.65% <ø> (-1.26%) ⬇️
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Instrumentation.AWS 83.69% <ø> (ø)
unittests-Instrumentation.AspNet 74.93% <ø> (ø)
unittests-Instrumentation.AspNetCore 70.76% <ø> (ø)
unittests-Instrumentation.Cassandra 23.52% <ø> (ø)
unittests-Instrumentation.ConfluentKafka 14.10% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.12% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 79.11% <ø> (ø)
unittests-Instrumentation.EventCounters 76.36% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.42% <ø> (ø)
unittests-Instrumentation.GrpcNetClient 79.61% <ø> (ø)
unittests-Instrumentation.Hangfire 84.61% <ø> (ø)
unittests-Instrumentation.Http 74.18% <ø> (ø)
unittests-Instrumentation.Owin 88.62% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 78.76% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 34.54% <ø> (ø)
unittests-Instrumentation.SqlClient 87.16% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 70.81% <ø> (ø)
unittests-Instrumentation.Wcf 78.95% <ø> (ø)
unittests-OpAmp.Client 61.08% <ø> (ø)
unittests-PersistentStorage 65.88% <ø> (ø)
unittests-Resources.AWS 75.00% <ø> (ø)
unittests-Resources.Azure 84.56% <ø> (ø)
unittests-Resources.Container 67.34% <ø> (ø)
unittests-Resources.Gcp 71.42% <ø> (ø)
unittests-Resources.Host 73.91% <ø> (ø)
unittests-Resources.OperatingSystem 76.98% <ø> (ø)
unittests-Resources.Process 100.00% <ø> (ø)
unittests-Resources.ProcessRuntime 79.59% <ø> (ø)
unittests-Sampler.AWS 88.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 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.

Split out the implementation in `[EnabledOnDockerPlatformTheory]` to allow for a `[EnabledOnDockerPlatformFact]`.
@martincostello martincostello force-pushed the add-EnabledOnDockerPlatformFact branch from 4b4eb71 to 4902e78 Compare August 22, 2025 16:18
Copy link
Member

@rajkumar-rangaraj rajkumar-rangaraj left a comment

Choose a reason for hiding this comment

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

LGTM

@rajkumar-rangaraj rajkumar-rangaraj merged commit 61c71ee into open-telemetry:main Aug 22, 2025
223 checks passed
@Kielek
Copy link
Member

Kielek commented Aug 22, 2025

👍

@martincostello martincostello deleted the add-EnabledOnDockerPlatformFact branch August 22, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants