-
Notifications
You must be signed in to change notification settings - Fork 802
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
[Shims.OpenTracing] enable code analysis #6160
Merged
rajkumar-rangaraj
merged 18 commits into
open-telemetry:main
from
Kielek:analysis-OpenTelemetry.Shims.OpenTracing
Mar 11, 2025
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5c781e5
[Shims.OpenTracing] enable code analysis
Kielek 162964e
CA1859
Kielek 7e2fdcf
CA1307
Kielek d056c72
IDE0028
Kielek 74b4a50
IDE0074
Kielek f9c46ab
IDE0025
Kielek 57a1ac7
Enable for tests
Kielek 074f92d
CA1852
Kielek de3cf4e
CA2000
Kielek 269a033
CA1859
Kielek 0e20ff5
CA1307
Kielek 5201147
CA1034
Kielek 3aa6ca5
remove unused class
Kielek dbab7dd
Disable CA1515
Kielek 7aa4323
Merge branch 'main' into analysis-OpenTelemetry.Shims.OpenTracing
Kielek 0e713c8
Merge branch 'main' into analysis-OpenTelemetry.Shims.OpenTracing
Kielek 8fa3b27
Merge branch 'main' into analysis-OpenTelemetry.Shims.OpenTracing
Kielek bac7bdb
Merge branch 'main' into analysis-OpenTelemetry.Shims.OpenTracing
rajkumar-rangaraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 3 additions & 27 deletions
30
test/OpenTelemetry.Shims.OpenTracing.Tests/ListenAndSampleAllActivitySources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,11 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Diagnostics; | ||
using Xunit; | ||
|
||
namespace OpenTelemetry.Shims.OpenTracing.Tests; | ||
|
||
[CollectionDefinition(nameof(ListenAndSampleAllActivitySources))] | ||
public sealed class ListenAndSampleAllActivitySources : ICollectionFixture<ListenAndSampleAllActivitySources.Fixture> | ||
{ | ||
public sealed class Fixture : IDisposable | ||
{ | ||
private readonly ActivityListener listener; | ||
|
||
public Fixture() | ||
{ | ||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; | ||
Activity.ForceDefaultIdFormat = true; | ||
|
||
this.listener = new ActivityListener | ||
{ | ||
ShouldListenTo = _ => true, | ||
Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllDataAndRecorded, | ||
}; | ||
|
||
ActivitySource.AddActivityListener(this.listener); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
this.listener.Dispose(); | ||
} | ||
} | ||
} | ||
#pragma warning disable CA1515 | ||
public sealed class ListenAndSampleAllActivitySources : ICollectionFixture<ListenAndSampleAllActivitySourcesFixture>; | ||
#pragma warning restore CA1515 |
32 changes: 32 additions & 0 deletions
32
test/OpenTelemetry.Shims.OpenTracing.Tests/ListenAndSampleAllActivitySourcesFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Diagnostics; | ||
|
||
namespace OpenTelemetry.Shims.OpenTracing.Tests; | ||
|
||
#pragma warning disable CA1515 | ||
public sealed class ListenAndSampleAllActivitySourcesFixture : IDisposable | ||
#pragma warning restore CA1515 | ||
{ | ||
private readonly ActivityListener listener; | ||
|
||
public ListenAndSampleAllActivitySourcesFixture() | ||
{ | ||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; | ||
Activity.ForceDefaultIdFormat = true; | ||
|
||
this.listener = new ActivityListener | ||
{ | ||
ShouldListenTo = _ => true, | ||
Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllDataAndRecorded, | ||
}; | ||
|
||
ActivitySource.AddActivityListener(this.listener); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
this.listener.Dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI