Skip to content

Commit

Permalink
Remove StackExchangeRedis Instrumenation (#3346)
Browse files Browse the repository at this point in the history
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
  • Loading branch information
utpilla and cijothomas authored Jun 7, 2022
1 parent 8df82a2 commit c90ab4a
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 1,682 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/integration-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ on:
- '**.md'

jobs:
redis-test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'

sql-test:
runs-on: ubuntu-latest
strategy:
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ on:
- '**.md'

jobs:
redis-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3

- name: Run redis docker-compose.integration
run: docker-compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build

sql-test:
runs-on: ubuntu-latest
strategy:
Expand Down
12 changes: 0 additions & 12 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testdata", "testdata", "{77
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.3.1", "test\TestApp.AspNetCore.3.1\TestApp.AspNetCore.3.1.csproj", "{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis", "src\OpenTelemetry.Instrumentation.StackExchangeRedis\OpenTelemetry.Instrumentation.StackExchangeRedis.csproj", "{6B681D72-D68A-44CC-8C75-53B9A322E6EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests", "test\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests\OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj", "{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{E359BB2B-9AEC-497D-B321-7DF2450C3B8E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Jaeger", "src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj", "{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}"
Expand Down Expand Up @@ -274,14 +270,6 @@ Global
{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.Build.0 = Release|Any CPU
{6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.Build.0 = Release|Any CPU
{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.Build.0 = Release|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ libraries](https://github.com/open-telemetry/opentelemetry-specification/blob/ma
* [ASP.NET Core](./src/OpenTelemetry.Instrumentation.AspNetCore/README.md)
* [Grpc.Net.Client](./src/OpenTelemetry.Instrumentation.GrpcNetClient/README.md)
* [HTTP clients](./src/OpenTelemetry.Instrumentation.Http/README.md)
* [Redis client](./src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md)
* [SQL client](./src/OpenTelemetry.Instrumentation.SqlClient/README.md)

Here are the [exporter
Expand Down
1 change: 0 additions & 1 deletion build/Common.nonprod.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<NewtonsoftJsonPkgVer>[12.0.2,13.0)</NewtonsoftJsonPkgVer>
<MoqPkgVer>[4.14.5,5.0)</MoqPkgVer>
<RabbitMQClientPkgVer>[6.1.0,7.0)</RabbitMQClientPkgVer>
<StackExchangeRedisPkgVer>[2.1.58,3.0)</StackExchangeRedisPkgVer>
<SwashbuckleAspNetCorePkgVer>[6.2.3]</SwashbuckleAspNetCorePkgVer>
<XUnitRunnerVisualStudioPkgVer>[2.4.3,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.4.1,3.0)</XUnitPkgVer>
Expand Down
1 change: 0 additions & 1 deletion build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<MicrosoftSourceLinkGitHubPkgVer>[1.0.0,2.0)</MicrosoftSourceLinkGitHubPkgVer>
<OpenTracingPkgVer>[0.12.1,0.13)</OpenTracingPkgVer>
<OTelPreviousStableVer>1.3.0</OTelPreviousStableVer>
<StackExchangeRedisPkgVer>[2.1.58,3.0)</StackExchangeRedisPkgVer>
<StyleCopAnalyzersPkgVer>[1.2.0-beta.354,2.0)</StyleCopAnalyzersPkgVer>
<SystemCollectionsImmutablePkgVer>1.4.0</SystemCollectionsImmutablePkgVer>
<SystemDiagnosticSourcePkgVer>6.0.0</SystemDiagnosticSourcePkgVer>
Expand Down
65 changes: 30 additions & 35 deletions docs/trace/extending-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ may be used as a reference.

The [inspiration of the OpenTelemetry
project](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md#instrumentation-libraries)
is to make every library observable out of the box by having
them call OpenTelemetry API directly. However, many libraries will not have such
is to make every library observable out of the box by having them call
OpenTelemetry API directly. However, many libraries will not have such
integration, and as such there is a need for a separate library which would
inject such calls, using mechanisms such as wrapping interfaces, subscribing to
library-specific callbacks, or translating existing telemetry into OpenTelemetry
Expand All @@ -103,11 +103,11 @@ the following instrumentation libraries. The individual docs for them describes
the library they instrument, and steps for enabling them.

* [ASP.NET](../../../src/OpenTelemetry.Instrumentation.AspNet/README.md)
* [ASP.NET Core](../../../src/OpenTelemetry.Instrumentation.AspNetCore/README.md)
* [gRPC client](../../../src/OpenTelemetry.Instrumentation.GrpcNetClient/README.md)
* [ASP.NET
Core](../../../src/OpenTelemetry.Instrumentation.AspNetCore/README.md)
* [gRPC
client](../../../src/OpenTelemetry.Instrumentation.GrpcNetClient/README.md)
* [HTTP clients](../../../src/OpenTelemetry.Instrumentation.Http/README.md)
* [Redis
client](../../../src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md)
* [SQL client](../../../src/OpenTelemetry.Instrumentation.SqlClient/README.md)

More community contributed instrumentations are available in [OpenTelemetry .NET
Expand Down Expand Up @@ -135,13 +135,9 @@ modify to emit activities directly.*
Writing an instrumentation library typically involves 3 steps.

1. First step involves "hijacking" into the target library. The exact mechanism
of this depends on the target library itself. For example, StackExchangeRedis
library allows hooks into the library, and the [StackExchangeRedis
instrumentation
library](../../../src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md)
in this case, leverages them. Another example is System.Data.SqlClient for
.NET Framework, which publishes events using `EventSource`. The [SqlClient
instrumentation
of this depends on the target library itself. For example,
System.Data.SqlClient for .NET Framework, which publishes events using
`EventSource`. The [SqlClient instrumentation
library](../../../src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlEventSourceListener.netfx.cs),
in this case subscribes to the `EventSource` callbacks.

Expand All @@ -151,20 +147,19 @@ Writing an instrumentation library typically involves 3 steps.
target instrumented library. Irrespective of the actual mechanism used in
first step, this should be uniform across all instrumentation libraries. The
`ActivitySource` must be created using the name and version of the
instrumentation library (eg:
"OpenTelemetry.Instrumentation.StackExchangeRedis") and *not* the
instrumented library (eg: "StackExchange.Redis")
1. [Context Propagation](../../../src/OpenTelemetry.Api/README.md#context-propagation):
If your library initiates out of process requests or
accepts them, the library needs to
[inject the `PropagationContext`](../../../examples/MicroserviceExample/Utils/Messaging/MessageSender.cs)
to outgoing requests and
[extract the context](../../../examples/MicroserviceExample/Utils/Messaging/MessageReceiver.cs)
and hydrate the Activity/Baggage upon receiving incoming requests.
This is only required if you're using your own protocol to
communicate over the wire.
(i.e. If you're using an already instrumented HttpClient or GrpcClient,
this is already provided to you and **do not require**
instrumentation library (eg: "OpenTelemetry.Instrumentation.Http") and *not*
the instrumented library (eg: "System.Net.Http")
1. [Context
Propagation](../../../src/OpenTelemetry.Api/README.md#context-propagation):
If your library initiates out of process requests or accepts them, the
library needs to [inject the
`PropagationContext`](../../../examples/MicroserviceExample/Utils/Messaging/MessageSender.cs)
to outgoing requests and [extract the
context](../../../examples/MicroserviceExample/Utils/Messaging/MessageReceiver.cs)
and hydrate the Activity/Baggage upon receiving incoming requests. This is
only required if you're using your own protocol to communicate over the
wire. (i.e. If you're using an already instrumented HttpClient or
GrpcClient, this is already provided to you and **do not require**
injecting/extracting `PropagationContext` explicitly again.)

3. Third step is an optional step, and involves providing extension methods on
Expand All @@ -179,8 +174,8 @@ Writing an instrumentation library typically involves 3 steps.
extension method on `TracerProviderBuilder`. Inside this extension
method, it should call the `AddInstrumentation` method, and `AddSource`
method to enable its ActivitySource for the provider. An example
instrumentation using this approach is [StackExchangeRedis
instrumentation](../../../src/OpenTelemetry.Instrumentation.StackExchangeRedis/TracerProviderBuilderExtensions.cs)
instrumentation using this approach is [SqlClient
instrumentation](../../../src/OpenTelemetry.Instrumentation.SqlClient/TracerProviderBuilderExtensions.cs)

2. If the instrumentation library does not requires any state management
tied to that of `TracerProvider`, then providing `TracerProviderBuilder`
Expand Down Expand Up @@ -326,16 +321,16 @@ A demo sampler is shown [here](./MySampler.cs).

## Resource Detector

OpenTelemetry .NET SDK provides a resource detector for detecting
resource information from the `OTEL_RESOURCE_ATTRIBUTES` and
`OTEL_SERVICE_NAME` environment variables.
OpenTelemetry .NET SDK provides a resource detector for detecting resource
information from the `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME`
environment variables.

Custom resource detectors can be implemented:

* ResourceDetectors should inherit from
`OpenTelemetry.Resources.IResourceDetector`, (which belongs
to the [OpenTelemetry](../../../src/OpenTelemetry/README.md)
package), and implement the `Detect` method.
`OpenTelemetry.Resources.IResourceDetector`, (which belongs to the
[OpenTelemetry](../../../src/OpenTelemetry/README.md) package), and implement
the `Detect` method.

A demo ResourceDetector is shown [here](./MyResourceDetector.cs).

Expand Down
2 changes: 0 additions & 2 deletions examples/Console/Examples.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StackExchange.Redis" Version="$(StackExchangeRedisPkgVer)" />

<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\SpanAttributeConstants.cs" Link="Includes\SpanAttributeConstants.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.GrpcNetClient\OpenTelemetry.Instrumentation.GrpcNetClient.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.StackExchangeRedis\OpenTelemetry.Instrumentation.StackExchangeRedis.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.ZPages\OpenTelemetry.Exporter.ZPages.csproj" />
Expand Down
10 changes: 1 addition & 9 deletions examples/Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Program
/// <param name="args">Arguments from command line.</param>
public static void Main(string[] args)
{
Parser.Default.ParseArguments<JaegerOptions, ZipkinOptions, PrometheusOptions, MetricsOptions, LogsOptions, GrpcNetClientOptions, HttpClientOptions, RedisOptions, ZPagesOptions, ConsoleOptions, OpenTelemetryShimOptions, OpenTracingShimOptions, OtlpOptions, InMemoryOptions>(args)
Parser.Default.ParseArguments<JaegerOptions, ZipkinOptions, PrometheusOptions, MetricsOptions, LogsOptions, GrpcNetClientOptions, HttpClientOptions, ZPagesOptions, ConsoleOptions, OpenTelemetryShimOptions, OpenTracingShimOptions, OtlpOptions, InMemoryOptions>(args)
.MapResult(
(JaegerOptions options) => TestJaegerExporter.Run(options.Host, options.Port),
(ZipkinOptions options) => TestZipkinExporter.Run(options.Uri),
Expand All @@ -55,7 +55,6 @@ public static void Main(string[] args)
(LogsOptions options) => TestLogs.Run(options),
(GrpcNetClientOptions options) => TestGrpcNetClient.Run(),
(HttpClientOptions options) => TestHttpClient.Run(),
(RedisOptions options) => TestRedis.Run(options.Uri),
(ZPagesOptions options) => TestZPagesExporter.Run(),
(ConsoleOptions options) => TestConsoleExporter.Run(options),
(OpenTelemetryShimOptions options) => TestOTelShimWithConsoleExporter.Run(options),
Expand Down Expand Up @@ -127,13 +126,6 @@ internal class HttpClientOptions
{
}

[Verb("redis", HelpText = "Specify the options required to test Redis with Zipkin")]
internal class RedisOptions
{
[Option('u', "uri", HelpText = "Please specify the uri of Zipkin backend", Required = true)]
public string Uri { get; set; }
}

[Verb("zpages", HelpText = "Specify the options required to test ZPages")]
internal class ZPagesOptions
{
Expand Down
111 changes: 0 additions & 111 deletions examples/Console/TestRedis.cs

This file was deleted.

Empty file.
Loading

0 comments on commit c90ab4a

Please sign in to comment.