Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shared] Fix analysis warnings #953

Merged
merged 3 commits into from
Feb 22, 2023
Merged

[Shared] Fix analysis warnings #953

merged 3 commits into from
Feb 22, 2023

Conversation

martincostello
Copy link
Contributor

Changes

Fix/suppress code analysis warnings in OpenTelemetry.Contrib.Shared.

Contributes to #950.

@martincostello martincostello requested a review from a team February 3, 2023 14:55
@@ -87,11 +89,11 @@ public void OnError(Exception error)
/// <inheritdoc/>
public void Dispose()
{
this.Dispose(true);
this.DisposeInternal();
Copy link
Member

Choose a reason for hiding this comment

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

nit: Just FYI in a sealed class you can slim down the disposal pattern. This would be fine:

    public void Dispose()
    {
        if (Interlocked.CompareExchange(ref this.disposed, 1, 0) == 1)
        {
            return;
        }
        lock (this.listenerSubscriptions)
        {
            foreach (var listenerSubscription in this.listenerSubscriptions)
            {
                listenerSubscription?.Dispose();
            }
            this.listenerSubscriptions.Clear();
        }
        this.allSourcesSubscription?.Dispose();
        this.allSourcesSubscription = null;
    }

@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #953 (1a01ffb) into main (d0190c3) will decrease coverage by 0.44%.
The diff coverage is n/a.

❗ Current head 1a01ffb differs from pull request most recent head d6da5b6. Consider uploading reports for the commit d6da5b6 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
- Coverage   69.39%   68.95%   -0.44%     
==========================================
  Files         200      199       -1     
  Lines        7636     7589      -47     
==========================================
- Hits         5299     5233      -66     
- Misses       2337     2356      +19     
Impacted Files Coverage Δ
...porter.OneCollector/OneCollectorExporterOptions.cs 0.00% <0.00%> (-100.00%) ⬇️
...orter.OneCollector/Logs/OneCollectorLogExporter.cs 0.00% <0.00%> (-100.00%) ⬇️
...neCollector/Logs/OneCollectorLogExporterOptions.cs 0.00% <0.00%> (-90.91%) ⬇️
...neCollectorOpenTelemetryLoggerOptionsExtensions.cs 0.00% <0.00%> (-76.00%) ⬇️
...eCollector/OneCollectorExporterTransportOptions.cs 0.00% <0.00%> (-72.23%) ⬇️
...etry.Exporter.OneCollector/OneCollectorExporter.cs 0.00% <0.00%> (-50.00%) ⬇️
...ourceDetectors.Azure/AppServiceResourceDetector.cs 81.81% <0.00%> (-5.69%) ⬇️
...tor/Internal/Sinks/WriteDirectlyToTransportSink.cs 89.47% <0.00%> (-1.32%) ⬇️
...strumentation.GrpcCore/ClientTracingInterceptor.cs 89.63% <0.00%> (-0.71%) ⬇️
...strumentation.GrpcCore/ServerTracingInterceptor.cs 97.75% <0.00%> (-0.19%) ⬇️
... and 13 more

Fix/suppress code analysis warnings in OpenTelemetry.Contrib.Shared.
Contributes to #950.
Apply code review feedback and put the code to dispose inline.
@utpilla utpilla merged commit 9787846 into open-telemetry:main Feb 22, 2023
@martincostello martincostello deleted the issue-950-analysers-shared branch February 22, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants