open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
421 stars 251 forks source link

[Resources.AWS] Prevent potential deadlocks by removing .Result calls #1922

Closed joegoldman2 closed 1 day ago

joegoldman2 commented 6 days ago

Changes

Prevent potential deadlocks by removing .Result calls in favour of TaskFactory.StartNew(...).

More context: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1699#discussion_r1610995831

For significant contributions please make sure you have completed the following items:

codecov[bot] commented 6 days ago

Codecov Report

Attention: Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.

Project coverage is 77.93%. Comparing base (71655ce) to head (27d8ade). Report is 346 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922/graphs/tree.svg?width=650&height=150&src=pr&token=DG2DEROH83&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-contrib/pull/1922?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 #1922 +/- ## ========================================== + Coverage 73.91% 77.93% +4.01% ========================================== Files 267 12 -255 Lines 9615 290 -9325 ========================================== - Hits 7107 226 -6881 + Misses 2508 64 -2444 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [unittests-Resources.AWS](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `77.93% <84.61%> (?)` | | 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](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?src=pr&el=tree&filepath=src%2FOpenTelemetry.Resources.AWS%2FAWSECSDetector.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuUmVzb3VyY2VzLkFXUy9BV1NFQ1NEZXRlY3Rvci5jcw==) | `87.87% <100.00%> (ø)` | | | [src/OpenTelemetry.Resources.AWS/AsyncHelper.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?src=pr&el=tree&filepath=src%2FOpenTelemetry.Resources.AWS%2FAsyncHelper.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuUmVzb3VyY2VzLkFXUy9Bc3luY0hlbHBlci5jcw==) | `100.00% <100.00%> (ø)` | | | [...enTelemetry.Resources.AWS/ResourceDetectorUtils.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?src=pr&el=tree&filepath=src%2FOpenTelemetry.Resources.AWS%2FResourceDetectorUtils.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuUmVzb3VyY2VzLkFXUy9SZXNvdXJjZURldGVjdG9yVXRpbHMuY3M=) | `100.00% <100.00%> (ø)` | | | [src/OpenTelemetry.Resources.AWS/AWSEC2Detector.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?src=pr&el=tree&filepath=src%2FOpenTelemetry.Resources.AWS%2FAWSEC2Detector.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuUmVzb3VyY2VzLkFXUy9BV1NFQzJEZXRlY3Rvci5jcw==) | `74.28% <33.33%> (ø)` | | | [src/OpenTelemetry.Resources.AWS/AWSEKSDetector.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922?src=pr&el=tree&filepath=src%2FOpenTelemetry.Resources.AWS%2FAWSEKSDetector.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuUmVzb3VyY2VzLkFXUy9BV1NFS1NEZXRlY3Rvci5jcw==) | `58.62% <0.00%> (ø)` | | ... and [274 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1922/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)
joegoldman2 commented 6 days ago

@ppittle, this PR is ready to be reviewed.

ppittle commented 1 day ago

@joegoldman2 - thanks for your contribution!

Kielek commented 1 day ago

@ppittle, @joegoldman2 - do you think that it is worth to document in changelog?

joegoldman2 commented 1 day ago

I would say no. I see the change as a implementation detail that should not change the behavior.