-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Shims.OpenTracing] enable code analysis (#6160)
Co-authored-by: Rajkumar Rangaraj <rajrang@microsoft.com>
- Loading branch information
1 parent
8943733
commit c977f73
Showing
15 changed files
with
61 additions
and
74 deletions.
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