open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.23k stars 765 forks source link

[repo] Take advantage of System.Threading.Lock when compiling against .NET9 #5861

Closed CodeBlanch closed 1 month ago

CodeBlanch commented 1 month ago

Changes

Merge requirement checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.40%. Comparing base (6250307) to head (114634e). Report is 330 commits behind head on main.

Files with missing lines Patch % Lines
...metry.Exporter.Console/ConsoleLogRecordExporter.cs 0.00% 1 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/graphs/tree.svg?width=650&height=150&src=pr&token=vscyfvPfy5&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #5861 +/- ## ========================================== + Coverage 83.38% 86.40% +3.02% ========================================== Files 297 257 -40 Lines 12531 11203 -1328 ========================================== - Hits 10449 9680 -769 + Misses 2082 1523 -559 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `?` | | | [unittests-Project-Experimental](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.29% <90.00%> (?)` | | | [unittests-Project-Stable](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.20% <90.00%> (?)` | | | [unittests-Solution](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.25% <90.00%> (?)` | | | [unittests-UnstableCoreLibraries-Experimental](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `85.68% <100.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [....Prometheus.HttpListener/PrometheusHttpListener.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Prometheus.HttpListener%2FPrometheusHttpListener.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuUHJvbWV0aGV1cy5IdHRwTGlzdGVuZXIvUHJvbWV0aGV1c0h0dHBMaXN0ZW5lci5jcw==) | `82.35% <100.00%> (+0.64%)` | :arrow_up: | | [...Telemetry/Internal/SelfDiagnosticsEventListener.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FInternal%2FSelfDiagnosticsEventListener.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvSW50ZXJuYWwvU2VsZkRpYWdub3N0aWNzRXZlbnRMaXN0ZW5lci5jcw==) | `97.69% <100.00%> (+0.01%)` | :arrow_up: | | [src/OpenTelemetry/Metrics/AggregatorStore.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FMetrics%2FAggregatorStore.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvTWV0cmljcy9BZ2dyZWdhdG9yU3RvcmUuY3M=) | `87.78% <100.00%> (+7.39%)` | :arrow_up: | | [src/OpenTelemetry/Metrics/MeterProviderSdk.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FMetrics%2FMeterProviderSdk.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvTWV0cmljcy9NZXRlclByb3ZpZGVyU2RrLmNz) | `93.46% <100.00%> (+5.62%)` | :arrow_up: | | [src/OpenTelemetry/Metrics/Reader/MetricReader.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FMetrics%2FReader%2FMetricReader.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvTWV0cmljcy9SZWFkZXIvTWV0cmljUmVhZGVyLmNz) | `88.59% <100.00%> (ø)` | | | [...rc/OpenTelemetry/Metrics/Reader/MetricReaderExt.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FMetrics%2FReader%2FMetricReaderExt.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvTWV0cmljcy9SZWFkZXIvTWV0cmljUmVhZGVyRXh0LmNz) | `92.24% <100.00%> (ø)` | | | [src/OpenTelemetry/SimpleExportProcessor.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry%2FSimpleExportProcessor.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkvU2ltcGxlRXhwb3J0UHJvY2Vzc29yLmNz) | `100.00% <100.00%> (ø)` | | | [...metry.Exporter.Console/ConsoleLogRecordExporter.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Console%2FConsoleLogRecordExporter.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuQ29uc29sZS9Db25zb2xlTG9nUmVjb3JkRXhwb3J0ZXIuY3M=) | `0.00% <0.00%> (ø)` | | ... and [226 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5861/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)
MarkCiliaVincenti commented 1 month ago

Consider using Backport.System.Threading.Lock instead of this method for locking, because it allows you to use the methods that the System.Threading.Lock class provides.