diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index e3a9bb26aaf..1654c561810 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -43,21 +43,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Api", "src\Op EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.Dependencies", "src\OpenTelemetry.Adapter.Dependencies\OpenTelemetry.Adapter.Dependencies.csproj", "{D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.Dependencies", "src\OpenTelemetry.Instrumentation.Dependencies\OpenTelemetry.Instrumentation.Dependencies.csproj", "{D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.Dependencies.Tests", "test\OpenTelemetry.Adapter.Dependencies.Tests\OpenTelemetry.Adapter.Dependencies.Tests.csproj", "{56E2647A-B814-4BAC-B854-BEA0051B5F2E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.Dependencies.Tests", "test\OpenTelemetry.Instrumentation.Dependencies.Tests\OpenTelemetry.Instrumentation.Dependencies.Tests.csproj", "{56E2647A-B814-4BAC-B854-BEA0051B5F2E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.AspNetCore", "src\OpenTelemetry.Adapter.AspNetCore\OpenTelemetry.Adapter.AspNetCore.csproj", "{752D2182-A351-41D8-99EE-DD363D7D5B43}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNetCore", "src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj", "{752D2182-A351-41D8-99EE-DD363D7D5B43}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.AspNetCore.Tests", "test\OpenTelemetry.Adapter.AspNetCore.Tests\OpenTelemetry.Adapter.AspNetCore.Tests.csproj", "{2A47F6A8-63E5-4237-8046-94CAF321E797}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNetCore.Tests", "test\OpenTelemetry.Instrumentation.AspNetCore.Tests\OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj", "{2A47F6A8-63E5-4237-8046-94CAF321E797}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testdata", "testdata", "{77C7929A-2EED-4AA6-8705-B5C443C8AA0F}" 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.Adapter.StackExchangeRedis", "src\OpenTelemetry.Adapter.StackExchangeRedis\OpenTelemetry.Adapter.StackExchangeRedis.csproj", "{6B681D72-D68A-44CC-8C75-53B9A322E6EC}" +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.Adapter.StackExchangeRedis.Tests", "test\OpenTelemetry.Adapter.StackExchangeRedis.Tests\OpenTelemetry.Adapter.StackExchangeRedis.Tests.csproj", "{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}" +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}") = "samples", "samples", "{E359BB2B-9AEC-497D-B321-7DF2450C3B8E}" EndProject @@ -104,11 +104,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Zipk EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.AspNet.Win", "samples\Exporters\AspNet\OpenTelemetry.Exporter.AspNet.Win.csproj", "{9A4E3A68-904B-4835-A3C8-F664B73098DB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.AspNet.Win", "src\OpenTelemetry.Adapter.AspNet\OpenTelemetry.Adapter.AspNet.Win.csproj", "{B9EEACDD-CAFA-4B75-A18D-898E7DE21B17}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNet.Win", "src\OpenTelemetry.Instrumentation.AspNet.Win\OpenTelemetry.Instrumentation.AspNet.Win.csproj", "{B9EEACDD-CAFA-4B75-A18D-898E7DE21B17}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Adapter.AspNet.Tests.Win", "test\OpenTelemetry.Adapter.AspNet.Tests\OpenTelemetry.Adapter.AspNet.Tests.Win.csproj", "{55CBAADE-7040-46D6-A845-F207B4F0E281}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNet.Tests.Win", "test\OpenTelemetry.Instrumentation.AspNet.Tests.Win\OpenTelemetry.Instrumentation.AspNet.Tests.Win.csproj", "{55CBAADE-7040-46D6-A845-F207B4F0E281}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests", "test\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj", "{7C4026CA-6434-4762-8B77-D657EAEE1325}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests", "test\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj", "{7C4026CA-6434-4762-8B77-D657EAEE1325}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -128,10 +128,6 @@ Global {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.Build.0 = Release|Any CPU - {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.Build.0 = Release|Any CPU {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -160,10 +156,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 - {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1FA1F509-7722-48E3-9A35-16CBB6774957}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1FA1F509-7722-48E3-9A35-16CBB6774957}.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 diff --git a/samples/Exporters/AspNet/Global.asax.cs b/samples/Exporters/AspNet/Global.asax.cs index 70ab6f67a05..2e6ada6c367 100644 --- a/samples/Exporters/AspNet/Global.asax.cs +++ b/samples/Exporters/AspNet/Global.asax.cs @@ -20,8 +20,8 @@ protected void Application_Start() c.AgentHost = "localhost"; c.AgentPort = 6831; }) - .AddRequestAdapter() - .AddDependencyAdapter(); + .AddRequestInstrumentation() + .AddDependencyInstrumentation(); }); GlobalConfiguration.Configure(WebApiConfig.Register); diff --git a/samples/Exporters/AspNet/OpenTelemetry.Exporter.AspNet.Win.csproj b/samples/Exporters/AspNet/OpenTelemetry.Exporter.AspNet.Win.csproj index 4c4e3a0ff24..7d9ffa6b6d2 100644 --- a/samples/Exporters/AspNet/OpenTelemetry.Exporter.AspNet.Win.csproj +++ b/samples/Exporters/AspNet/OpenTelemetry.Exporter.AspNet.Win.csproj @@ -84,13 +84,13 @@ {99f8a331-05e9-45a5-89ba-4c54e825e5b2} OpenTelemetry.Api - + {b9eeacdd-cafa-4b75-a18d-898e7de21b17} - OpenTelemetry.Adapter.AspNet.Win + OpenTelemetry.Instrumentation.AspNet.Win - + {d3ffbc59-2486-4f8f-bff1-fa95c84929e1} - OpenTelemetry.Adapter.Dependencies + OpenTelemetry.Instrumentation.Dependencies {8d47e3cf-9ae3-42fe-9084-feb72d9ad769} @@ -111,8 +111,8 @@ - - + + $(BuildDependsOn) diff --git a/samples/Exporters/Console/Exporters.csproj b/samples/Exporters/Console/Exporters.csproj index a45eb44b2e1..a7411ee9597 100644 --- a/samples/Exporters/Console/Exporters.csproj +++ b/samples/Exporters/Console/Exporters.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/samples/Exporters/Console/TestHttpClient.cs b/samples/Exporters/Console/TestHttpClient.cs index dec173f315f..4b725788a8d 100644 --- a/samples/Exporters/Console/TestHttpClient.cs +++ b/samples/Exporters/Console/TestHttpClient.cs @@ -28,7 +28,7 @@ internal static object Run() using var tracerFactory = TracerFactory.Create(builder => builder .UseZipkin(o => o.ServiceName = "http-client-test") - .AddDependencyAdapter()); + .AddDependencyInstrumentation()); var tracer = tracerFactory.GetTracer("http-client-test"); using (tracer.StartActiveSpan("incoming request", out _)) diff --git a/samples/Exporters/Console/TestRedis.cs b/samples/Exporters/Console/TestRedis.cs index 40b48db5d09..3ec3f344806 100644 --- a/samples/Exporters/Console/TestRedis.cs +++ b/samples/Exporters/Console/TestRedis.cs @@ -16,7 +16,7 @@ using System; using System.Collections.Generic; using System.Threading; -using OpenTelemetry.Adapter.StackExchangeRedis; +using OpenTelemetry.Instrumentation.StackExchangeRedis; using OpenTelemetry.Trace; using OpenTelemetry.Trace.Configuration; using StackExchange.Redis; @@ -37,11 +37,11 @@ internal static object Run(string zipkinUri) o.ServiceName = "redis-test"; o.Endpoint = new Uri(zipkinUri); }) - .AddAdapter(t => + .AddInstrumentation(t => { - var adapter = new StackExchangeRedisCallsAdapter(t); - connection.RegisterProfiler(adapter.GetProfilerSessionsFactory()); - return adapter; + var instrumentation = new StackExchangeRedisCallsInstrumentation(t); + connection.RegisterProfiler(instrumentation.GetProfilerSessionsFactory()); + return instrumentation; })); var tracer = tracerFactory.GetTracer("redis-test"); diff --git a/samples/Exporters/Web/OpenTelemetry.Exporter.Web.csproj b/samples/Exporters/Web/OpenTelemetry.Exporter.Web.csproj index 5647a047d75..ee116bb9aee 100644 --- a/samples/Exporters/Web/OpenTelemetry.Exporter.Web.csproj +++ b/samples/Exporters/Web/OpenTelemetry.Exporter.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/samples/Exporters/Web/Startup.cs b/samples/Exporters/Web/Startup.cs index da5a4a77bfc..a30a3b0ec75 100644 --- a/samples/Exporters/Web/Startup.cs +++ b/samples/Exporters/Web/Startup.cs @@ -45,8 +45,8 @@ public void ConfigureServices(IServiceCollection services) options.ServiceName = "test-zipkin"; options.Endpoint = new Uri(this.Configuration.GetValue("Zipkin:Endpoint")); }) - .AddRequestAdapter() - .AddDependencyAdapter(); + .AddRequestInstrumentation() + .AddDependencyInstrumentation(); }); } diff --git a/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/LoggingTracer.Demo.AspNetCore.csproj b/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/LoggingTracer.Demo.AspNetCore.csproj index b50e843fb70..6740a6bddb5 100644 --- a/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/LoggingTracer.Demo.AspNetCore.csproj +++ b/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/LoggingTracer.Demo.AspNetCore.csproj @@ -10,9 +10,9 @@ - + - + diff --git a/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/Startup.cs b/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/Startup.cs index ab9e5468c9a..15b88b0e5b8 100644 --- a/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/Startup.cs +++ b/samples/LoggingTracer/LoggingTracer.Demo.AspNetCore/Startup.cs @@ -9,8 +9,8 @@ namespace LoggingTracer.Demo.AspNetCore using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; - using OpenTelemetry.Adapter.AspNetCore; - using OpenTelemetry.Adapter.Dependencies; + using OpenTelemetry.Instrumentation.AspNetCore; + using OpenTelemetry.Instrumentation.Dependencies; public class Startup { @@ -21,8 +21,8 @@ public void ConfigureServices(IServiceCollection services) var tracerFactory = new LoggingTracerFactory(); var tracer = tracerFactory.GetTracer("ServerApp", "semver:1.0.0"); - var dependenciesAdapter = new DependenciesAdapter(tracerFactory); - var aspNetCoreAdapter = new AspNetCoreAdapter(tracer); + var dependenciesInstrumentation = new DependenciesInstrumentation(tracerFactory); + var aspNetCoreInstrumentation = new AspNetCoreInstrumentation(tracer); return tracerFactory; }); diff --git a/src/OpenTelemetry.Adapter.Dependencies/DependenciesAdapter.cs b/src/OpenTelemetry.Adapter.Dependencies/DependenciesAdapter.cs deleted file mode 100644 index ec0032be4eb..00000000000 --- a/src/OpenTelemetry.Adapter.Dependencies/DependenciesAdapter.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -using System; -using System.Collections.Generic; -using OpenTelemetry.Trace; - -namespace OpenTelemetry.Adapter.Dependencies -{ - /// - /// Instrumentation adaptor that automatically collect calls to Http, SQL, and Azure SDK. - /// - public class DependenciesAdapter : IDisposable - { - private readonly List adapters = new List(); - - /// - /// Initializes a new instance of the class. - /// - /// Tracer factory to get a tracer from. - /// Http configuration options. - /// Sql configuration options. - public DependenciesAdapter(TracerFactoryBase tracerFactory, HttpClientAdapterOptions httpOptions = null, SqlClientAdapterOptions sqlOptions = null) - { - if (tracerFactory == null) - { - throw new ArgumentNullException(nameof(tracerFactory)); - } - - var assemblyVersion = typeof(DependenciesAdapter).Assembly.GetName().Version; - - var httpClientListener = new HttpClientAdapter(tracerFactory.GetTracer(nameof(HttpClientAdapter), "semver:" + assemblyVersion), httpOptions ?? new HttpClientAdapterOptions()); - var httpWebRequestAdapter = new HttpWebRequestAdapter(tracerFactory.GetTracer(nameof(HttpWebRequestAdapter), "semver:" + assemblyVersion), httpOptions ?? new HttpClientAdapterOptions()); - var azureClientsListener = new AzureClientsAdapter(tracerFactory.GetTracer(nameof(AzureClientsAdapter), "semver:" + assemblyVersion)); - var azurePipelineListener = new AzurePipelineAdapter(tracerFactory.GetTracer(nameof(AzurePipelineAdapter), "semver:" + assemblyVersion)); - var sqlClientListener = new SqlClientAdapter(tracerFactory.GetTracer(nameof(AzurePipelineAdapter), "semver:" + assemblyVersion), sqlOptions ?? new SqlClientAdapterOptions()); - - this.adapters.Add(httpClientListener); - this.adapters.Add(httpWebRequestAdapter); - this.adapters.Add(azureClientsListener); - this.adapters.Add(azurePipelineListener); - this.adapters.Add(sqlClientListener); - } - - /// - public void Dispose() - { - foreach (var adapter in this.adapters) - { - adapter.Dispose(); - } - } - } -} diff --git a/src/OpenTelemetry.Extensions.Hosting/Implementation/TelemetryFactoryHostedService.cs b/src/OpenTelemetry.Extensions.Hosting/Implementation/TelemetryFactoryHostedService.cs index ddec5d7433c..8c3605c98a2 100644 --- a/src/OpenTelemetry.Extensions.Hosting/Implementation/TelemetryFactoryHostedService.cs +++ b/src/OpenTelemetry.Extensions.Hosting/Implementation/TelemetryFactoryHostedService.cs @@ -35,7 +35,7 @@ public TelemetryFactoryHostedService(IServiceProvider serviceProvider) public Task StartAsync(CancellationToken cancellationToken) { // Ensure the factory was created when the app starts. - // This will create and start any configured adapters. + // This will create and start any configured instrumentations. this.serviceProvider.GetRequiredService(); return Task.CompletedTask; diff --git a/src/OpenTelemetry.Adapter.AspNet/AspNetAdapter.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentation.cs similarity index 70% rename from src/OpenTelemetry.Adapter.AspNet/AspNetAdapter.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentation.cs index d929dcbc87b..906b9157dd4 100644 --- a/src/OpenTelemetry.Adapter.AspNet/AspNetAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,35 +14,35 @@ // limitations under the License. // using System; -using OpenTelemetry.Adapter.AspNet.Implementation; +using OpenTelemetry.Instrumentation.AspNet.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.AspNet +namespace OpenTelemetry.Instrumentation.AspNet { /// - /// Requests adapter. + /// Requests instrumentation. /// - public class AspNetAdapter : IDisposable + public class AspNetInstrumentation : IDisposable { internal const string AspNetDiagnosticListenerName = "Microsoft.AspNet.TelemetryCorrelation"; private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public AspNetAdapter(Tracer tracer) - : this(tracer, new AspNetAdapterOptions()) + public AspNetInstrumentation(Tracer tracer) + : this(tracer, new AspNetInstrumentationOptions()) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - /// Configuration options for ASP.NET adapter. - public AspNetAdapter(Tracer tracer, AspNetAdapterOptions options) + /// Configuration options for ASP.NET instrumentation. + public AspNetInstrumentation(Tracer tracer, AspNetInstrumentationOptions options) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber( name => new HttpInListener(name, tracer, options), diff --git a/src/OpenTelemetry.Adapter.AspNet/AspNetAdapterOptions.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentationOptions.cs similarity index 84% rename from src/OpenTelemetry.Adapter.AspNet/AspNetAdapterOptions.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentationOptions.cs index ea049ebb0a4..7538298403d 100644 --- a/src/OpenTelemetry.Adapter.AspNet/AspNetAdapterOptions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/AspNetInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,12 @@ using System.Web; using OpenTelemetry.Context.Propagation; -namespace OpenTelemetry.Adapter.AspNet +namespace OpenTelemetry.Instrumentation.AspNet { /// - /// Options for requests adapter. + /// Options for requests instrumentation. /// - public class AspNetAdapterOptions + public class AspNetInstrumentationOptions { /// /// Gets or sets for context propagation. diff --git a/src/OpenTelemetry.Adapter.Dependencies/AssemblyInfo.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/AssemblyInfo.cs similarity index 60% rename from src/OpenTelemetry.Adapter.Dependencies/AssemblyInfo.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/AssemblyInfo.cs index fe67bbc785e..a1332ffde0d 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/AssemblyInfo.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/AssemblyInfo.cs @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // - using System.Runtime.CompilerServices; #if SIGNED -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.Dependencies.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNet.Tests.Win, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] #else -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.Dependencies.Tests")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNet.Tests.Win")] #endif diff --git a/src/OpenTelemetry.Adapter.AspNet/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/HttpInListener.cs similarity index 89% rename from src/OpenTelemetry.Adapter.AspNet/Implementation/HttpInListener.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/HttpInListener.cs index 5d6f07b3550..2c86ac5dade 100644 --- a/src/OpenTelemetry.Adapter.AspNet/Implementation/HttpInListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/HttpInListener.cs @@ -21,15 +21,15 @@ using OpenTelemetry.Context.Propagation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.AspNet.Implementation +namespace OpenTelemetry.Instrumentation.AspNet.Implementation { internal class HttpInListener : ListenerHandler { private readonly PropertyFetcher routeFetcher = new PropertyFetcher("Route"); private readonly PropertyFetcher routeTemplateFetcher = new PropertyFetcher("RouteTemplate"); - private readonly AspNetAdapterOptions options; + private readonly AspNetInstrumentationOptions options; - public HttpInListener(string name, Tracer tracer, AspNetAdapterOptions options) + public HttpInListener(string name, Tracer tracer, AspNetInstrumentationOptions options) : base(name, tracer) { this.options = options ?? throw new ArgumentNullException(nameof(options)); @@ -42,13 +42,13 @@ public override void OnStartActivity(Activity activity, object payload) var context = HttpContext.Current; if (context == null) { - AdapterEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); return; } if (this.options.RequestFilter != null && !this.options.RequestFilter(context)) { - AdapterEventSource.Log.RequestIsFilteredOut(activity.OperationName); + InstrumentationEventSource.Log.RequestIsFilteredOut(activity.OperationName); return; } @@ -90,7 +90,7 @@ public override void OnStopActivity(Activity activity, object payload) if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpInListener) + EventNameSuffix); return; } @@ -99,7 +99,7 @@ public override void OnStopActivity(Activity activity, object payload) var context = HttpContext.Current; if (context == null) { - AdapterEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); return; } diff --git a/src/OpenTelemetry.Adapter.AspNet/Implementation/PropertyFetcher.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/PropertyFetcher.cs similarity index 98% rename from src/OpenTelemetry.Adapter.AspNet/Implementation/PropertyFetcher.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/PropertyFetcher.cs index 1dc6abce438..1373f62695a 100644 --- a/src/OpenTelemetry.Adapter.AspNet/Implementation/PropertyFetcher.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/Implementation/PropertyFetcher.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Reflection; -namespace OpenTelemetry.Adapter.AspNet.Implementation +namespace OpenTelemetry.Instrumentation.AspNet.Implementation { internal class PropertyFetcher { diff --git a/src/OpenTelemetry.Adapter.AspNet/OpenTelemetry.Adapter.AspNet.Win.csproj b/src/OpenTelemetry.Instrumentation.AspNet.Win/OpenTelemetry.Instrumentation.AspNet.Win.csproj similarity index 76% rename from src/OpenTelemetry.Adapter.AspNet/OpenTelemetry.Adapter.AspNet.Win.csproj rename to src/OpenTelemetry.Instrumentation.AspNet.Win/OpenTelemetry.Instrumentation.AspNet.Win.csproj index 7287ae9c78a..3aeab26ff3e 100644 --- a/src/OpenTelemetry.Adapter.AspNet/OpenTelemetry.Adapter.AspNet.Win.csproj +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/OpenTelemetry.Instrumentation.AspNet.Win.csproj @@ -1,8 +1,8 @@  net46 - OpenTelemetry adapter for ASP.NET requests. - OpenTelemetry.Adapter.AspNet + OpenTelemetry instrumentation for ASP.NET requests. + OpenTelemetry.Instrumentation.AspNet $(PackageTags);distributed-tracing;AspNet;MVC;WebAPI diff --git a/src/OpenTelemetry.Adapter.AspNet/README.md b/src/OpenTelemetry.Instrumentation.AspNet.Win/README.md similarity index 82% rename from src/OpenTelemetry.Adapter.AspNet/README.md rename to src/OpenTelemetry.Instrumentation.AspNet.Win/README.md index dd550362459..55458b1dc20 100644 --- a/src/OpenTelemetry.Adapter.AspNet/README.md +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/README.md @@ -1,8 +1,8 @@ -# ASP.NET adapter +# ASP.NET Instrumentation Configuration with ASP.NET (Full .NET Framework) running in IIS or IIS Express (if supported) to collect incoming request information. -1. Add a reference to the `OpenTelemetry.Adapter.AspNet` package. Add any other adapters & exporters you will need. +1. Add a reference to the `OpenTelemetry.Instrumentation.AspNet` package. Add any other instrumentations & exporters you will need. 2. Add the Microsoft telemetry module in your `Web.config`: @@ -31,8 +31,8 @@ Configuration with ASP.NET (Full .NET Framework) running in IIS or IIS Express ( c.AgentHost = "localhost"; c.AgentPort = 6831; }) - .AddRequestAdapter() - .AddDependencyAdapter(); + .AddRequestInstrumentation() + .AddDependencyInstrumentation(); }); } protected void Application_End() diff --git a/src/OpenTelemetry.Adapter.AspNetCore/TracerBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNet.Win/TracerBuilderExtensions.cs similarity index 79% rename from src/OpenTelemetry.Adapter.AspNetCore/TracerBuilderExtensions.cs rename to src/OpenTelemetry.Instrumentation.AspNet.Win/TracerBuilderExtensions.cs index a3a5ec3e0de..1666fd51dcc 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/TracerBuilderExtensions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet.Win/TracerBuilderExtensions.cs @@ -15,7 +15,7 @@ // using System; -using OpenTelemetry.Adapter.AspNetCore; +using OpenTelemetry.Instrumentation.AspNet; namespace OpenTelemetry.Trace.Configuration { @@ -29,14 +29,14 @@ public static class TracerBuilderExtensions /// /// Trace builder to use. /// The instance of to chain the calls. - public static TracerBuilder AddRequestAdapter(this TracerBuilder builder) + public static TracerBuilder AddRequestInstrumentation(this TracerBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } - return builder.AddAdapter(t => new AspNetCoreAdapter(t)); + return builder.AddInstrumentation(t => new AspNetInstrumentation(t)); } /// @@ -45,7 +45,7 @@ public static TracerBuilder AddRequestAdapter(this TracerBuilder builder) /// Trace builder to use. /// Configuration options. /// The instance of to chain the calls. - public static TracerBuilder AddRequestAdapter(this TracerBuilder builder, Action configure) + public static TracerBuilder AddRequestInstrumentation(this TracerBuilder builder, Action configure) { if (builder == null) { @@ -57,10 +57,10 @@ public static TracerBuilder AddRequestAdapter(this TracerBuilder builder, Action throw new ArgumentNullException(nameof(configure)); } - var options = new AspNetCoreAdapterOptions(); + var options = new AspNetInstrumentationOptions(); configure(options); - return builder.AddAdapter(t => new AspNetCoreAdapter(t, options)); + return builder.AddInstrumentation(t => new AspNetInstrumentation(t, options)); } } } diff --git a/src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapter.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentation.cs similarity index 72% rename from src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapter.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentation.cs index 3f6e2952015..d7f67589ff7 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,33 +14,33 @@ // limitations under the License. // using System; -using OpenTelemetry.Adapter.AspNetCore.Implementation; +using OpenTelemetry.Instrumentation.AspNetCore.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.AspNetCore +namespace OpenTelemetry.Instrumentation.AspNetCore { /// - /// Requests adapter. + /// Requests instrumentation. /// - public class AspNetCoreAdapter : IDisposable + public class AspNetCoreInstrumentation : IDisposable { private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public AspNetCoreAdapter(Tracer tracer) - : this(tracer, new AspNetCoreAdapterOptions()) + public AspNetCoreInstrumentation(Tracer tracer) + : this(tracer, new AspNetCoreInstrumentationOptions()) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - /// Configuration options for ASP.NET Core adapter. - public AspNetCoreAdapter(Tracer tracer, AspNetCoreAdapterOptions options) + /// Configuration options for ASP.NET Core instrumentation. + public AspNetCoreInstrumentation(Tracer tracer, AspNetCoreInstrumentationOptions options) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpInListener("Microsoft.AspNetCore", tracer, options), null); this.diagnosticSourceSubscriber.Subscribe(); diff --git a/src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapterOptions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs similarity index 84% rename from src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapterOptions.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs index 8f103daa6b8..687774be972 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/AspNetCoreAdapterOptions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,12 @@ using Microsoft.AspNetCore.Http; using OpenTelemetry.Context.Propagation; -namespace OpenTelemetry.Adapter.AspNetCore +namespace OpenTelemetry.Instrumentation.AspNetCore { /// - /// Options for requests adapter. + /// Options for requests instrumentation. /// - public class AspNetCoreAdapterOptions + public class AspNetCoreInstrumentationOptions { /// /// Gets or sets for context propagation. diff --git a/src/OpenTelemetry.Adapter.AspNet/AssemblyInfo.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AssemblyInfo.cs similarity index 60% rename from src/OpenTelemetry.Adapter.AspNet/AssemblyInfo.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/AssemblyInfo.cs index a02f16af91a..8dd4826ded0 100644 --- a/src/OpenTelemetry.Adapter.AspNet/AssemblyInfo.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AssemblyInfo.cs @@ -16,7 +16,7 @@ using System.Runtime.CompilerServices; #if SIGNED -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.AspNet.Tests.Win, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNetCore.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] #else -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.AspNet.Tests.Win")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNetCore.Tests")] #endif diff --git a/src/OpenTelemetry.Adapter.AspNetCore/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs similarity index 91% rename from src/OpenTelemetry.Adapter.AspNetCore/Implementation/HttpInListener.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs index 51b6a0878e3..689d9a47183 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/Implementation/HttpInListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs @@ -23,7 +23,7 @@ using OpenTelemetry.Context.Propagation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.AspNetCore.Implementation +namespace OpenTelemetry.Instrumentation.AspNetCore.Implementation { internal class HttpInListener : ListenerHandler { @@ -34,9 +34,9 @@ internal class HttpInListener : ListenerHandler private readonly PropertyFetcher beforeActionAttributeRouteInfoFetcher = new PropertyFetcher("AttributeRouteInfo"); private readonly PropertyFetcher beforeActionTemplateFetcher = new PropertyFetcher("Template"); private readonly bool hostingSupportsW3C = false; - private readonly AspNetCoreAdapterOptions options; + private readonly AspNetCoreInstrumentationOptions options; - public HttpInListener(string name, Tracer tracer, AspNetCoreAdapterOptions options) + public HttpInListener(string name, Tracer tracer, AspNetCoreInstrumentationOptions options) : base(name, tracer) { this.hostingSupportsW3C = typeof(HttpRequest).Assembly.GetName().Version.Major >= 3; @@ -50,13 +50,13 @@ public override void OnStartActivity(Activity activity, object payload) if (context == null) { - AdapterEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); return; } if (this.options.RequestFilter != null && !this.options.RequestFilter(context)) { - AdapterEventSource.Log.RequestIsFilteredOut(activity.OperationName); + InstrumentationEventSource.Log.RequestIsFilteredOut(activity.OperationName); return; } @@ -99,7 +99,7 @@ public override void OnStopActivity(Activity activity, object payload) if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpInListener) + EventNameSuffix); return; } @@ -107,7 +107,7 @@ public override void OnStopActivity(Activity activity, object payload) { if (!(this.stopContextFetcher.Fetch(payload) is HttpContext context)) { - AdapterEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpInListener) + EventNameSuffix); return; } @@ -127,7 +127,7 @@ public override void OnCustom(string name, Activity activity, object payload) if (span == null) { - AdapterEventSource.Log.NullOrBlankSpan(name); + InstrumentationEventSource.Log.NullOrBlankSpan(name); return; } diff --git a/src/OpenTelemetry.Adapter.AspNetCore/Implementation/PropertyFetcher.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/PropertyFetcher.cs similarity index 98% rename from src/OpenTelemetry.Adapter.AspNetCore/Implementation/PropertyFetcher.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/PropertyFetcher.cs index 9f7c2ec1e63..c1b980a8d27 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/Implementation/PropertyFetcher.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/PropertyFetcher.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Reflection; -namespace OpenTelemetry.Adapter.AspNetCore.Implementation +namespace OpenTelemetry.Instrumentation.AspNetCore.Implementation { internal class PropertyFetcher { diff --git a/src/OpenTelemetry.Adapter.AspNetCore/OpenTelemetry.Adapter.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj similarity index 84% rename from src/OpenTelemetry.Adapter.AspNetCore/OpenTelemetry.Adapter.AspNetCore.csproj rename to src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj index c5d2a13ddb7..0a05054d513 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/OpenTelemetry.Adapter.AspNetCore.csproj +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj @@ -1,7 +1,7 @@  netstandard2.0 - OpenTelemetry adapter for ASP.NET Core requests. + OpenTelemetry instrumentation for ASP.NET Core requests. $(PackageTags);distributed-tracing;AspNetCore diff --git a/src/OpenTelemetry.Adapter.AspNet/TracerBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerBuilderExtensions.cs similarity index 79% rename from src/OpenTelemetry.Adapter.AspNet/TracerBuilderExtensions.cs rename to src/OpenTelemetry.Instrumentation.AspNetCore/TracerBuilderExtensions.cs index 4adf8857228..916f3416804 100644 --- a/src/OpenTelemetry.Adapter.AspNet/TracerBuilderExtensions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerBuilderExtensions.cs @@ -15,7 +15,7 @@ // using System; -using OpenTelemetry.Adapter.AspNet; +using OpenTelemetry.Instrumentation.AspNetCore; namespace OpenTelemetry.Trace.Configuration { @@ -29,14 +29,14 @@ public static class TracerBuilderExtensions /// /// Trace builder to use. /// The instance of to chain the calls. - public static TracerBuilder AddRequestAdapter(this TracerBuilder builder) + public static TracerBuilder AddRequestInstrumentation(this TracerBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } - return builder.AddAdapter(t => new AspNetAdapter(t)); + return builder.AddInstrumentation(t => new AspNetCoreInstrumentation(t)); } /// @@ -45,7 +45,7 @@ public static TracerBuilder AddRequestAdapter(this TracerBuilder builder) /// Trace builder to use. /// Configuration options. /// The instance of to chain the calls. - public static TracerBuilder AddRequestAdapter(this TracerBuilder builder, Action configure) + public static TracerBuilder AddRequestInstrumentation(this TracerBuilder builder, Action configure) { if (builder == null) { @@ -57,10 +57,10 @@ public static TracerBuilder AddRequestAdapter(this TracerBuilder builder, Action throw new ArgumentNullException(nameof(configure)); } - var options = new AspNetAdapterOptions(); + var options = new AspNetCoreInstrumentationOptions(); configure(options); - return builder.AddAdapter(t => new AspNetAdapter(t, options)); + return builder.AddInstrumentation(t => new AspNetCoreInstrumentation(t, options)); } } } diff --git a/src/OpenTelemetry.Adapter.AspNetCore/AssemblyInfo.cs b/src/OpenTelemetry.Instrumentation.Dependencies/AssemblyInfo.cs similarity index 60% rename from src/OpenTelemetry.Adapter.AspNetCore/AssemblyInfo.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/AssemblyInfo.cs index e2eb1333e04..a8a642f3835 100644 --- a/src/OpenTelemetry.Adapter.AspNetCore/AssemblyInfo.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/AssemblyInfo.cs @@ -13,10 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // + using System.Runtime.CompilerServices; #if SIGNED -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.AspNetCore.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.Dependencies.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] #else -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.AspNetCore.Tests")] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.Dependencies.Tests")] #endif diff --git a/src/OpenTelemetry.Adapter.Dependencies/AzureClientsAdapter.cs b/src/OpenTelemetry.Instrumentation.Dependencies/AzureClientsInstrumentation.cs similarity index 81% rename from src/OpenTelemetry.Adapter.Dependencies/AzureClientsAdapter.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/AzureClientsInstrumentation.cs index a1ca87e9805..864abb000d5 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/AzureClientsAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/AzureClientsInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,20 +16,20 @@ using System; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Dependencies adapter. + /// Dependencies instrumentation. /// - public class AzureClientsAdapter : IDisposable + public class AzureClientsInstrumentation : IDisposable { private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public AzureClientsAdapter(Tracer tracer) + public AzureClientsInstrumentation(Tracer tracer) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber( name => new AzureSdkDiagnosticListener(name, tracer), diff --git a/src/OpenTelemetry.Adapter.Dependencies/AzurePipelineAdapter.cs b/src/OpenTelemetry.Instrumentation.Dependencies/AzurePipelineInstrumentation.cs similarity index 79% rename from src/OpenTelemetry.Adapter.Dependencies/AzurePipelineAdapter.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/AzurePipelineInstrumentation.cs index fdce312ac38..5983fed196b 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/AzurePipelineAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/AzurePipelineInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,20 +16,20 @@ using System; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Dependencies adapter. + /// Dependencies instrumentation. /// - public class AzurePipelineAdapter : IDisposable + public class AzurePipelineInstrumentation : IDisposable { private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public AzurePipelineAdapter(Tracer tracer) + public AzurePipelineInstrumentation(Tracer tracer) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new AzureSdkDiagnosticListener("Azure.Pipeline", tracer), null); this.diagnosticSourceSubscriber.Subscribe(); diff --git a/src/OpenTelemetry.Adapter.Dependencies/Constants.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Constants.cs similarity index 85% rename from src/OpenTelemetry.Adapter.Dependencies/Constants.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Constants.cs index c0440076591..54652a51072 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Constants.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Constants.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +14,7 @@ // limitations under the License. // -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { internal static class Constants { diff --git a/src/OpenTelemetry.Instrumentation.Dependencies/DependenciesInstrumentation.cs b/src/OpenTelemetry.Instrumentation.Dependencies/DependenciesInstrumentation.cs new file mode 100644 index 00000000000..03c427186d6 --- /dev/null +++ b/src/OpenTelemetry.Instrumentation.Dependencies/DependenciesInstrumentation.cs @@ -0,0 +1,66 @@ +// +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +using System; +using System.Collections.Generic; +using OpenTelemetry.Trace; + +namespace OpenTelemetry.Instrumentation.Dependencies +{ + /// + /// Instrumentation adaptor that automatically collect calls to Http, SQL, and Azure SDK. + /// + public class DependenciesInstrumentation : IDisposable + { + private readonly List instrumentations = new List(); + + /// + /// Initializes a new instance of the class. + /// + /// Tracer factory to get a tracer from. + /// Http configuration options. + /// Sql configuration options. + public DependenciesInstrumentation(TracerFactoryBase tracerFactory, HttpClientInstrumentationOptions httpOptions = null, SqlClientInstrumentationOptions sqlOptions = null) + { + if (tracerFactory == null) + { + throw new ArgumentNullException(nameof(tracerFactory)); + } + + var assemblyVersion = typeof(DependenciesInstrumentation).Assembly.GetName().Version; + + var httpClientListener = new HttpClientInstrumentation(tracerFactory.GetTracer(nameof(HttpClientInstrumentation), "semver:" + assemblyVersion), httpOptions ?? new HttpClientInstrumentationOptions()); + var httpWebRequestInstrumentation = new HttpWebRequestInstrumentation(tracerFactory.GetTracer(nameof(HttpWebRequestInstrumentation), "semver:" + assemblyVersion), httpOptions ?? new HttpClientInstrumentationOptions()); + var azureClientsListener = new AzureClientsInstrumentation(tracerFactory.GetTracer(nameof(AzureClientsInstrumentation), "semver:" + assemblyVersion)); + var azurePipelineListener = new AzurePipelineInstrumentation(tracerFactory.GetTracer(nameof(AzurePipelineInstrumentation), "semver:" + assemblyVersion)); + var sqlClientListener = new SqlClientInstrumentation(tracerFactory.GetTracer(nameof(AzurePipelineInstrumentation), "semver:" + assemblyVersion), sqlOptions ?? new SqlClientInstrumentationOptions()); + + this.instrumentations.Add(httpClientListener); + this.instrumentations.Add(httpWebRequestInstrumentation); + this.instrumentations.Add(azureClientsListener); + this.instrumentations.Add(azurePipelineListener); + this.instrumentations.Add(sqlClientListener); + } + + /// + public void Dispose() + { + foreach (var instrumentation in this.instrumentations) + { + instrumentation.Dispose(); + } + } + } +} diff --git a/src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapter.cs b/src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentation.cs similarity index 72% rename from src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapter.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentation.cs index 02d98c53990..3f7ace26058 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,34 +14,33 @@ // limitations under the License. // using System; -using OpenTelemetry.Adapter.Dependencies.Implementation; -using OpenTelemetry.Context.Propagation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Dependencies adapter. + /// Dependencies instrumentation. /// - public class HttpClientAdapter : IDisposable + public class HttpClientInstrumentation : IDisposable { private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public HttpClientAdapter(Tracer tracer) - : this(tracer, new HttpClientAdapterOptions()) + public HttpClientInstrumentation(Tracer tracer) + : this(tracer, new HttpClientInstrumentationOptions()) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - /// Configuration options for dependencies adapter. - public HttpClientAdapter(Tracer tracer, HttpClientAdapterOptions options) + /// Configuration options for dependencies instrumentation. + public HttpClientInstrumentation(Tracer tracer, HttpClientInstrumentationOptions options) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpHandlerDiagnosticListener(tracer, options), options.EventFilter); this.diagnosticSourceSubscriber.Subscribe(); diff --git a/src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapterOptions.cs b/src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentationOptions.cs similarity index 88% rename from src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapterOptions.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentationOptions.cs index b7506a1ea24..b75484d725e 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/HttpClientAdapterOptions.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/HttpClientInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,29 +16,29 @@ using System; using System.Net; using System.Net.Http; -using OpenTelemetry.Adapter.Dependencies.Implementation; using OpenTelemetry.Context.Propagation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Options for dependencies adapter. + /// Options for dependencies instrumentation. /// - public class HttpClientAdapterOptions + public class HttpClientInstrumentationOptions { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public HttpClientAdapterOptions() + public HttpClientInstrumentationOptions() { this.EventFilter = DefaultFilter; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Custom filtering predicate for DiagnosticSource events, if any. - internal HttpClientAdapterOptions(Func eventFilter) + internal HttpClientInstrumentationOptions(Func eventFilter) { // TODO This API is unusable and likely to change, let's not expose it for now. diff --git a/src/OpenTelemetry.Adapter.Dependencies/HttpWebRequestAdapter.net461.cs b/src/OpenTelemetry.Instrumentation.Dependencies/HttpWebRequestInstrumentation.net461.cs similarity index 72% rename from src/OpenTelemetry.Adapter.Dependencies/HttpWebRequestAdapter.net461.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/HttpWebRequestInstrumentation.net461.cs index ed0f12b2802..b492ca9c616 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/HttpWebRequestAdapter.net461.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/HttpWebRequestInstrumentation.net461.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,35 +14,35 @@ // limitations under the License. // using System; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Dependencies adapter. + /// Dependencies instrumentation. /// - public class HttpWebRequestAdapter : IDisposable + public class HttpWebRequestInstrumentation : IDisposable { #if NET461 private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; #endif /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public HttpWebRequestAdapter(Tracer tracer) - : this(tracer, new HttpClientAdapterOptions()) + public HttpWebRequestInstrumentation(Tracer tracer) + : this(tracer, new HttpClientInstrumentationOptions()) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - /// Configuration options for HttpWebRequest adapter. - public HttpWebRequestAdapter(Tracer tracer, HttpClientAdapterOptions options) + /// Configuration options for HttpWebRequest instrumentation. + public HttpWebRequestInstrumentation(Tracer tracer, HttpClientInstrumentationOptions options) { #if NET461 GC.KeepAlive(HttpWebRequestDiagnosticSource.Instance); diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/AzureSdkDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/AzureSdkDiagnosticListener.cs similarity index 93% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/AzureSdkDiagnosticListener.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/AzureSdkDiagnosticListener.cs index 099d019ac06..4fa6ba35372 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/AzureSdkDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/AzureSdkDiagnosticListener.cs @@ -17,10 +17,10 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { internal class AzureSdkDiagnosticListener : ListenerHandler { @@ -94,7 +94,7 @@ public override void OnStopActivity(Activity current, object valueValue) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(this.SourceName + ".OnStopActivity"); + InstrumentationEventSource.Log.NullOrBlankSpan(this.SourceName + ".OnStopActivity"); return; } @@ -118,7 +118,7 @@ public override void OnException(Activity current, object valueValue) if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(this.SourceName + ".OnException"); + InstrumentationEventSource.Log.NullOrBlankSpan(this.SourceName + ".OnException"); return; } diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs similarity index 92% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs index ac38d85d015..e37f828f83c 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs @@ -24,7 +24,7 @@ using OpenTelemetry.Context.Propagation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies.Implementation +namespace OpenTelemetry.Instrumentation.Dependencies.Implementation { internal class HttpHandlerDiagnosticListener : ListenerHandler { @@ -35,9 +35,9 @@ internal class HttpHandlerDiagnosticListener : ListenerHandler private readonly PropertyFetcher stopExceptionFetcher = new PropertyFetcher("Exception"); private readonly PropertyFetcher stopRequestStatusFetcher = new PropertyFetcher("RequestTaskStatus"); private readonly bool httpClientSupportsW3C = false; - private readonly HttpClientAdapterOptions options; + private readonly HttpClientInstrumentationOptions options; - public HttpHandlerDiagnosticListener(Tracer tracer, HttpClientAdapterOptions options) + public HttpHandlerDiagnosticListener(Tracer tracer, HttpClientInstrumentationOptions options) : base("HttpHandlerDiagnosticListener", tracer) { var framework = Assembly @@ -63,7 +63,7 @@ public override void OnStartActivity(Activity activity, object payload) const string EventNameSuffix = ".OnStartActivity"; if (!(this.startRequestFetcher.Fetch(payload) is HttpRequestMessage request)) { - AdapterEventSource.Log.NullPayload(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); return; } @@ -102,7 +102,7 @@ public override void OnStopActivity(Activity activity, object payload) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); return; } @@ -146,7 +146,7 @@ public override void OnException(Activity activity, object payload) if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); return; } @@ -154,7 +154,7 @@ public override void OnException(Activity activity, object payload) { if (!(this.stopExceptionFetcher.Fetch(payload) is Exception exc)) { - AdapterEventSource.Log.NullPayload(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpHandlerDiagnosticListener) + EventNameSuffix); return; } diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs similarity index 90% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs index 021f4f11713..816ef5e6628 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticListener.net461.cs @@ -20,16 +20,16 @@ using OpenTelemetry.Context.Propagation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies.Implementation +namespace OpenTelemetry.Instrumentation.Dependencies.Implementation { internal class HttpWebRequestDiagnosticListener : ListenerHandler { private readonly PropertyFetcher startRequestFetcher = new PropertyFetcher("Request"); private readonly PropertyFetcher stopResponseFetcher = new PropertyFetcher("Response"); private readonly PropertyFetcher stopExceptionFetcher = new PropertyFetcher("Exception"); - private readonly HttpClientAdapterOptions options; + private readonly HttpClientInstrumentationOptions options; - public HttpWebRequestDiagnosticListener(Tracer tracer, HttpClientAdapterOptions options) + public HttpWebRequestDiagnosticListener(Tracer tracer, HttpClientInstrumentationOptions options) : base(HttpWebRequestDiagnosticSource.DiagnosticListenerName, tracer) { this.options = options; @@ -40,7 +40,7 @@ public override void OnStartActivity(Activity activity, object payload) const string EventNameSuffix = ".OnStartActivity"; if (!(this.startRequestFetcher.Fetch(payload) is HttpWebRequest request)) { - AdapterEventSource.Log.NullPayload(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); return; } @@ -73,7 +73,7 @@ public override void OnStopActivity(Activity activity, object payload) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); return; } @@ -99,7 +99,7 @@ public override void OnException(Activity activity, object payload) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullOrBlankSpan(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); return; } @@ -107,7 +107,7 @@ public override void OnException(Activity activity, object payload) { if (!(this.stopExceptionFetcher.Fetch(payload) is Exception exc)) { - AdapterEventSource.Log.NullPayload(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); + InstrumentationEventSource.Log.NullPayload(nameof(HttpWebRequestDiagnosticListener) + EventNameSuffix); return; } diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs similarity index 99% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs index 34465b2b2e2..82a8297d90f 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/HttpWebRequestDiagnosticSource.net461.cs @@ -23,7 +23,7 @@ using System.Reflection.Emit; using System.Text; -namespace OpenTelemetry.Adapter.Dependencies.Implementation +namespace OpenTelemetry.Instrumentation.Dependencies.Implementation { /// /// Hooks into the class reflectively and writes diagnostic events as requests are processed. diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/PropertyFetcher.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/PropertyFetcher.cs similarity index 98% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/PropertyFetcher.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/PropertyFetcher.cs index 65942ca19e0..db90919fd25 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/PropertyFetcher.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/PropertyFetcher.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Reflection; -namespace OpenTelemetry.Adapter.Dependencies.Implementation +namespace OpenTelemetry.Instrumentation.Dependencies.Implementation { internal class PropertyFetcher { diff --git a/src/OpenTelemetry.Adapter.Dependencies/Implementation/SqlClientDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/SqlClientDiagnosticListener.cs similarity index 91% rename from src/OpenTelemetry.Adapter.Dependencies/Implementation/SqlClientDiagnosticListener.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/Implementation/SqlClientDiagnosticListener.cs index 0fd8f6c36c1..46ed0d29459 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/Implementation/SqlClientDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/Implementation/SqlClientDiagnosticListener.cs @@ -18,7 +18,7 @@ using System.Diagnostics; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies.Implementation +namespace OpenTelemetry.Instrumentation.Dependencies.Implementation { internal class SqlClientDiagnosticListener : ListenerHandler { @@ -40,9 +40,9 @@ internal class SqlClientDiagnosticListener : ListenerHandler private readonly PropertyFetcher commandTypeFetcher = new PropertyFetcher("CommandType"); private readonly PropertyFetcher commandTextFetcher = new PropertyFetcher("CommandText"); private readonly PropertyFetcher exceptionFetcher = new PropertyFetcher("Exception"); - private readonly SqlClientAdapterOptions options; + private readonly SqlClientInstrumentationOptions options; - public SqlClientDiagnosticListener(string sourceName, Tracer tracer, SqlClientAdapterOptions options) + public SqlClientDiagnosticListener(string sourceName, Tracer tracer, SqlClientInstrumentationOptions options) : base(sourceName, tracer) { this.options = options ?? throw new ArgumentNullException(nameof(options)); @@ -63,7 +63,7 @@ public override void OnCustom(string name, Activity activity, object payload) if (command == null) { - AdapterEventSource.Log.NullPayload($"{nameof(SqlClientDiagnosticListener)}-{name}"); + InstrumentationEventSource.Log.NullPayload($"{nameof(SqlClientDiagnosticListener)}-{name}"); return; } @@ -118,7 +118,7 @@ public override void OnCustom(string name, Activity activity, object payload) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan($"{nameof(SqlClientDiagnosticListener)}-{name}"); + InstrumentationEventSource.Log.NullOrBlankSpan($"{nameof(SqlClientDiagnosticListener)}-{name}"); return; } } @@ -137,7 +137,7 @@ public override void OnCustom(string name, Activity activity, object payload) { if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan($"{nameof(SqlClientDiagnosticListener)}-{name}"); + InstrumentationEventSource.Log.NullOrBlankSpan($"{nameof(SqlClientDiagnosticListener)}-{name}"); return; } @@ -149,7 +149,7 @@ public override void OnCustom(string name, Activity activity, object payload) } else { - AdapterEventSource.Log.NullPayload($"{nameof(SqlClientDiagnosticListener)}-{name}"); + InstrumentationEventSource.Log.NullPayload($"{nameof(SqlClientDiagnosticListener)}-{name}"); } } } diff --git a/src/OpenTelemetry.Adapter.Dependencies/OpenTelemetry.Adapter.Dependencies.csproj b/src/OpenTelemetry.Instrumentation.Dependencies/OpenTelemetry.Instrumentation.Dependencies.csproj similarity index 76% rename from src/OpenTelemetry.Adapter.Dependencies/OpenTelemetry.Adapter.Dependencies.csproj rename to src/OpenTelemetry.Instrumentation.Dependencies/OpenTelemetry.Instrumentation.Dependencies.csproj index 71a514d15c3..aa10f8a4033 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/OpenTelemetry.Adapter.Dependencies.csproj +++ b/src/OpenTelemetry.Instrumentation.Dependencies/OpenTelemetry.Instrumentation.Dependencies.csproj @@ -1,7 +1,7 @@  netstandard2.0;net461 - OpenTelemetry adapter for Http, Sql, & Azure dependencies. + OpenTelemetry instrumentation for Http, Sql, & Azure dependencies. $(PackageTags);distributed-tracing;HttpClient diff --git a/src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapter.cs b/src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentation.cs similarity index 75% rename from src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapter.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentation.cs index c3a13755f6f..32e0c6c4c54 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,35 +14,35 @@ // limitations under the License. // using System; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// SqlClient adapter. + /// SqlClient instrumentation. /// - public class SqlClientAdapter : IDisposable + public class SqlClientInstrumentation : IDisposable { internal const string SqlClientDiagnosticListenerName = "SqlClientDiagnosticListener"; private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public SqlClientAdapter(Tracer tracer) - : this(tracer, new SqlClientAdapterOptions()) + public SqlClientInstrumentation(Tracer tracer) + : this(tracer, new SqlClientInstrumentationOptions()) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - /// Configuration options for sql adapter. - public SqlClientAdapter(Tracer tracer, SqlClientAdapterOptions options) + /// Configuration options for sql instrumentation. + public SqlClientInstrumentation(Tracer tracer, SqlClientInstrumentationOptions options) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber( name => new SqlClientDiagnosticListener(name, tracer, options), diff --git a/src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapterOptions.cs b/src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentationOptions.cs similarity index 65% rename from src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapterOptions.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentationOptions.cs index 7ca1dc059eb..7f495567a98 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/SqlClientAdapterOptions.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/SqlClientInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,27 +15,27 @@ // using System.Data; -namespace OpenTelemetry.Adapter.Dependencies +namespace OpenTelemetry.Instrumentation.Dependencies { /// - /// Options for . + /// Options for . /// - public class SqlClientAdapterOptions + public class SqlClientInstrumentationOptions { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public SqlClientAdapterOptions() + public SqlClientInstrumentationOptions() { } /// - /// Gets or sets a value indicating whether or not the should capture the names of commands. Default value: True. + /// Gets or sets a value indicating whether or not the should capture the names of commands. Default value: True. /// public bool CaptureStoredProcedureCommandName { get; set; } = true; /// - /// Gets or sets a value indicating whether or not the should capture the text of commands. Default value: False. + /// Gets or sets a value indicating whether or not the should capture the text of commands. Default value: False. /// public bool CaptureTextCommandContent { get; set; } } diff --git a/src/OpenTelemetry.Adapter.Dependencies/TracerBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.Dependencies/TracerBuilderExtensions.cs similarity index 52% rename from src/OpenTelemetry.Adapter.Dependencies/TracerBuilderExtensions.cs rename to src/OpenTelemetry.Instrumentation.Dependencies/TracerBuilderExtensions.cs index 45300d2ac28..0dbde5b00b3 100644 --- a/src/OpenTelemetry.Adapter.Dependencies/TracerBuilderExtensions.cs +++ b/src/OpenTelemetry.Instrumentation.Dependencies/TracerBuilderExtensions.cs @@ -15,7 +15,7 @@ // using System; -using OpenTelemetry.Adapter.Dependencies; +using OpenTelemetry.Instrumentation.Dependencies; namespace OpenTelemetry.Trace.Configuration { @@ -29,7 +29,7 @@ public static class TracerBuilderExtensions /// /// Trace builder to use. /// The instance of to chain the calls. - public static TracerBuilder AddDependencyAdapter(this TracerBuilder builder) + public static TracerBuilder AddDependencyInstrumentation(this TracerBuilder builder) { if (builder == null) { @@ -37,42 +37,42 @@ public static TracerBuilder AddDependencyAdapter(this TracerBuilder builder) } return builder - .AddAdapter((t) => new AzureClientsAdapter(t)) - .AddAdapter((t) => new AzurePipelineAdapter(t)) - .AddAdapter((t) => new HttpClientAdapter(t)) - .AddAdapter((t) => new HttpWebRequestAdapter(t)) - .AddAdapter((t) => new SqlClientAdapter(t)); + .AddInstrumentation((t) => new AzureClientsInstrumentation(t)) + .AddInstrumentation((t) => new AzurePipelineInstrumentation(t)) + .AddInstrumentation((t) => new HttpClientInstrumentation(t)) + .AddInstrumentation((t) => new HttpWebRequestInstrumentation(t)) + .AddInstrumentation((t) => new SqlClientInstrumentation(t)); } /// /// Enables the outgoing requests automatic data collection. /// /// Trace builder to use. - /// Http configuration options. - /// Sql configuration options. + /// Http configuration options. + /// Sql configuration options. /// The instance of to chain the calls. - public static TracerBuilder AddDependencyAdapter( + public static TracerBuilder AddDependencyInstrumentation( this TracerBuilder builder, - Action configureHttpAdapterOptions = null, - Action configureSqlAdapterOptions = null) + Action configureHttpInstrumentationOptions = null, + Action configureSqlInstrumentationOptions = null) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } - var httpOptions = new HttpClientAdapterOptions(); - configureHttpAdapterOptions?.Invoke(httpOptions); + var httpOptions = new HttpClientInstrumentationOptions(); + configureHttpInstrumentationOptions?.Invoke(httpOptions); - var sqlOptions = new SqlClientAdapterOptions(); - configureSqlAdapterOptions?.Invoke(sqlOptions); + var sqlOptions = new SqlClientInstrumentationOptions(); + configureSqlInstrumentationOptions?.Invoke(sqlOptions); return builder - .AddAdapter((t) => new AzureClientsAdapter(t)) - .AddAdapter((t) => new AzurePipelineAdapter(t)) - .AddAdapter((t) => new HttpClientAdapter(t, httpOptions)) - .AddAdapter((t) => new HttpWebRequestAdapter(t, httpOptions)) - .AddAdapter((t) => new SqlClientAdapter(t, sqlOptions)); + .AddInstrumentation((t) => new AzureClientsInstrumentation(t)) + .AddInstrumentation((t) => new AzurePipelineInstrumentation(t)) + .AddInstrumentation((t) => new HttpClientInstrumentation(t, httpOptions)) + .AddInstrumentation((t) => new HttpWebRequestInstrumentation(t, httpOptions)) + .AddInstrumentation((t) => new SqlClientInstrumentation(t, sqlOptions)); } } } diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/AssemblyInfo.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/AssemblyInfo.cs similarity index 93% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/AssemblyInfo.cs rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/AssemblyInfo.cs index 54884fe264f..4ecd381011e 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/AssemblyInfo.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/AssemblyInfo.cs @@ -16,7 +16,7 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.StackExchangeRedis.Tests" + AssemblyInfo.PublicKey)] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.StackExchangeRedis.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] #if SIGNED diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs similarity index 97% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs index 68a43f93360..4330621d61b 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryToSpanConverter.cs @@ -17,7 +17,7 @@ using OpenTelemetry.Trace; using StackExchange.Redis.Profiling; -namespace OpenTelemetry.Adapter.StackExchangeRedis.Implementation +namespace OpenTelemetry.Instrumentation.StackExchangeRedis.Implementation { internal static class RedisProfilerEntryToSpanConverter { diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/OpenTelemetry.Adapter.StackExchangeRedis.csproj b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj similarity index 77% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/OpenTelemetry.Adapter.StackExchangeRedis.csproj rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj index 0dc99bc7184..1ab63633c04 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/OpenTelemetry.Adapter.StackExchangeRedis.csproj +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj @@ -1,7 +1,7 @@  netstandard2.0;net461 - OpenTelemetry adapter for Redis calls made by the StackExchange.Redis library. + OpenTelemetry instrumentation for Redis calls made by the StackExchange.Redis library. $(PackageTags);distributed-tracing;Redis;StackExchange.Redis diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/README.md b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md similarity index 52% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/README.md rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md index c5f2711b802..5041d6fd12b 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/README.md +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md @@ -1,11 +1,11 @@ -# Using StackExchange.Redis adapter +# Using StackExchange.Redis instrumentation Outgoing calls to Redis made using `StackExchange.Redis` library can be automatically tracked. 1. Install package to your project: - [OpenTelemetry.Adapter.StackExchangeRedis](https://www.nuget.org/packages/OpenTelemetry.Adapter.StackExchangeRedis) + [OpenTelemetry.Instrumentation.StackExchangeRedis](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.StackExchangeRedis) -2. Configure Redis adapter +2. Configure Redis instrumentation ```csharp // connect to the server @@ -15,11 +15,11 @@ Outgoing calls to Redis made using `StackExchange.Redis` library can be automati .SetSampler(new AlwaysSampleSampler()) .UseZipkin(options => {}) .SetResource(Resources.CreateServiceResource("my-service")) - .AddAdapter(t => + .AddInstrumentation(t => { - var adapter = new StackExchangeRedisCallsAdapter(t); - connection.RegisterProfiler(adapter.GetProfilerSessionsFactory()); - return adapter; + var instrumentation = new StackExchangeRedisCallsInstrumentation(t); + connection.RegisterProfiler(instrumentation.GetProfilerSessionsFactory()); + return instrumentation; }))) { } diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapter.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentation.cs similarity index 92% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapter.cs rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentation.cs index 20019a6768b..b1f738e8ac2 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapter.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentation.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,17 +19,17 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; -using OpenTelemetry.Adapter.StackExchangeRedis.Implementation; +using OpenTelemetry.Instrumentation.StackExchangeRedis.Implementation; using OpenTelemetry.Trace; using OpenTelemetry.Trace.Configuration; using StackExchange.Redis.Profiling; -namespace OpenTelemetry.Adapter.StackExchangeRedis +namespace OpenTelemetry.Instrumentation.StackExchangeRedis { /// - /// Redis calls adapter. + /// Redis calls instrumentation. /// - public class StackExchangeRedisCallsAdapter : IDisposable + public class StackExchangeRedisCallsInstrumentation : IDisposable { private readonly Tracer tracer; @@ -42,10 +42,10 @@ public class StackExchangeRedisCallsAdapter : IDisposable private readonly PropertyInfo spanEndTimestampInfo; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Tracer to record traced with. - public StackExchangeRedisCallsAdapter(Tracer tracer) + public StackExchangeRedisCallsInstrumentation(Tracer tracer) { this.tracer = tracer; diff --git a/src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapterOptions.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentationOptions.cs similarity index 70% rename from src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapterOptions.cs rename to src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentationOptions.cs index 3c8b37af51c..ac7989d135a 100644 --- a/src/OpenTelemetry.Adapter.StackExchangeRedis/StackExchangeRedisCallsAdapterOptions.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/StackExchangeRedisCallsInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,12 +14,12 @@ // limitations under the License. // -namespace OpenTelemetry.Adapter.StackExchangeRedis +namespace OpenTelemetry.Instrumentation.StackExchangeRedis { /// - /// Options for dependencies adapter. + /// Options for dependencies instrumentation. /// - public class StackExchangeRedisCallsAdapterOptions + public class StackExchangeRedisCallsInstrumentationOptions { } } diff --git a/src/OpenTelemetry.Shims.OpenTracing/ScopeManagerShim.cs b/src/OpenTelemetry.Shims.OpenTracing/ScopeManagerShim.cs index 29a9974cf8f..20a25dc4ef1 100644 --- a/src/OpenTelemetry.Shims.OpenTracing/ScopeManagerShim.cs +++ b/src/OpenTelemetry.Shims.OpenTracing/ScopeManagerShim.cs @@ -57,7 +57,7 @@ public ScopeManagerShim(Trace.Tracer tracer) return openTracingScope; } - return new ScopeAdapter(currentSpan); + return new ScopeInstrumentation(currentSpan); } } @@ -71,7 +71,7 @@ public ScopeManagerShim(Trace.Tracer tracer) var scope = this.tracer.WithSpan(shim.Span, false); - var adapter = new ScopeAdapter( + var instrumentation = new ScopeInstrumentation( shim.Span, () => { @@ -85,19 +85,19 @@ public ScopeManagerShim(Trace.Tracer tracer) scope.Dispose(); }); - SpanScopeTable.Add(shim.Span, adapter); + SpanScopeTable.Add(shim.Span, instrumentation); #if DEBUG Interlocked.Increment(ref this.spanScopeTableCount); #endif - return adapter; + return instrumentation; } - private class ScopeAdapter : global::OpenTracing.IScope + private class ScopeInstrumentation : global::OpenTracing.IScope { private readonly Action disposeAction; - public ScopeAdapter(TelemetrySpan span, Action disposeAction = null) + public ScopeInstrumentation(TelemetrySpan span, Action disposeAction = null) { this.Span = new SpanShim(span); this.disposeAction = disposeAction; diff --git a/src/OpenTelemetry.Shims.OpenTracing/SpanBuilderShim.cs b/src/OpenTelemetry.Shims.OpenTracing/SpanBuilderShim.cs index 24564e05650..001ceb007ff 100644 --- a/src/OpenTelemetry.Shims.OpenTracing/SpanBuilderShim.cs +++ b/src/OpenTelemetry.Shims.OpenTracing/SpanBuilderShim.cs @@ -50,9 +50,9 @@ public sealed class SpanBuilderShim : ISpanBuilder private readonly List> attributes = new List>(); /// - /// The set of operation names for System.Diagnostics.Activity based automatic adapters that indicate a root span. + /// The set of operation names for System.Diagnostics.Activity based automatic instrumentations that indicate a root span. /// - private readonly IList rootOperationNamesForActivityBasedAutoAdapters = new List + private readonly IList rootOperationNamesForActivityBasedAutoInstrumentations = new List { "Microsoft.AspNetCore.Hosting.HttpRequestIn", }; @@ -78,12 +78,12 @@ public sealed class SpanBuilderShim : ISpanBuilder private bool error; - public SpanBuilderShim(Trace.Tracer tracer, string spanName, IList rootOperationNamesForActivityBasedAutoAdapters = null) + public SpanBuilderShim(Trace.Tracer tracer, string spanName, IList rootOperationNamesForActivityBasedAutoInstrumentations = null) { this.tracer = tracer ?? throw new ArgumentNullException(nameof(tracer)); this.spanName = spanName ?? throw new ArgumentNullException(nameof(spanName)); this.ScopeManager = new ScopeManagerShim(this.tracer); - this.rootOperationNamesForActivityBasedAutoAdapters = rootOperationNamesForActivityBasedAutoAdapters ?? this.rootOperationNamesForActivityBasedAutoAdapters; + this.rootOperationNamesForActivityBasedAutoInstrumentations = rootOperationNamesForActivityBasedAutoInstrumentations ?? this.rootOperationNamesForActivityBasedAutoInstrumentations; } private global::OpenTracing.IScopeManager ScopeManager { get; } @@ -187,7 +187,7 @@ public ISpan Start() if (System.Diagnostics.Activity.Current != null && System.Diagnostics.Activity.Current.IdFormat == System.Diagnostics.ActivityIdFormat.W3C) { var currentActivity = System.Diagnostics.Activity.Current; - if (this.rootOperationNamesForActivityBasedAutoAdapters.Contains(currentActivity.OperationName)) + if (this.rootOperationNamesForActivityBasedAutoInstrumentations.Contains(currentActivity.OperationName)) { this.tracer.StartSpanFromActivity(this.spanName, currentActivity, this.spanKind, this.links); span = this.tracer.CurrentSpan; diff --git a/src/OpenTelemetry.Shims.OpenTracing/TracerShim.cs b/src/OpenTelemetry.Shims.OpenTracing/TracerShim.cs index fb30bb0191c..674c2b661fb 100644 --- a/src/OpenTelemetry.Shims.OpenTracing/TracerShim.cs +++ b/src/OpenTelemetry.Shims.OpenTracing/TracerShim.cs @@ -114,7 +114,7 @@ public void Inject( if ((format == BuiltinFormats.TextMap || format == BuiltinFormats.HttpHeaders) && carrier is ITextMap textMapCarrier) { - this.textFormat.Inject(shim.SpanContext, textMapCarrier, (adapter, key, value) => adapter.Set(key, value)); + this.textFormat.Inject(shim.SpanContext, textMapCarrier, (instrumentation, key, value) => instrumentation.Set(key, value)); } } } diff --git a/src/OpenTelemetry/Adapter/DiagnosticSourceListener.cs b/src/OpenTelemetry/Instrumentation/DiagnosticSourceListener.cs similarity index 90% rename from src/OpenTelemetry/Adapter/DiagnosticSourceListener.cs rename to src/OpenTelemetry/Instrumentation/DiagnosticSourceListener.cs index a841ad808a5..0b32319c3d3 100644 --- a/src/OpenTelemetry/Adapter/DiagnosticSourceListener.cs +++ b/src/OpenTelemetry/Instrumentation/DiagnosticSourceListener.cs @@ -18,7 +18,7 @@ using System.Collections.Generic; using System.Diagnostics; -namespace OpenTelemetry.Adapter +namespace OpenTelemetry.Instrumentation { internal class DiagnosticSourceListener : IObserver> { @@ -41,7 +41,7 @@ public void OnNext(KeyValuePair value) { if (Activity.Current == null) { - AdapterEventSource.Log.NullActivity(value.Key); + InstrumentationEventSource.Log.NullActivity(value.Key); return; } @@ -66,7 +66,7 @@ public void OnNext(KeyValuePair value) } catch (Exception ex) { - AdapterEventSource.Log.UnknownErrorProcessingEvent(this.handler?.SourceName, value.Key, ex); + InstrumentationEventSource.Log.UnknownErrorProcessingEvent(this.handler?.SourceName, value.Key, ex); } } } diff --git a/src/OpenTelemetry/Adapter/DiagnosticSourceSubscriber.cs b/src/OpenTelemetry/Instrumentation/DiagnosticSourceSubscriber.cs similarity index 98% rename from src/OpenTelemetry/Adapter/DiagnosticSourceSubscriber.cs rename to src/OpenTelemetry/Instrumentation/DiagnosticSourceSubscriber.cs index 09955ba9bf2..aa6d7d588a8 100644 --- a/src/OpenTelemetry/Adapter/DiagnosticSourceSubscriber.cs +++ b/src/OpenTelemetry/Instrumentation/DiagnosticSourceSubscriber.cs @@ -18,7 +18,7 @@ using System.Diagnostics; using System.Threading; -namespace OpenTelemetry.Adapter +namespace OpenTelemetry.Instrumentation { public class DiagnosticSourceSubscriber : IDisposable, IObserver { diff --git a/src/OpenTelemetry/Adapter/AdapterEventSource.cs b/src/OpenTelemetry/Instrumentation/InstrumentationEventSource.cs similarity index 91% rename from src/OpenTelemetry/Adapter/AdapterEventSource.cs rename to src/OpenTelemetry/Instrumentation/InstrumentationEventSource.cs index fd8c5897921..96d69870812 100644 --- a/src/OpenTelemetry/Adapter/AdapterEventSource.cs +++ b/src/OpenTelemetry/Instrumentation/InstrumentationEventSource.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,15 +19,15 @@ using System.Globalization; using System.Threading; -namespace OpenTelemetry.Adapter +namespace OpenTelemetry.Instrumentation { /// /// EventSource events emitted from the project. /// - [EventSource(Name = "OpenTelemetry-Adapter")] - public class AdapterEventSource : EventSource + [EventSource(Name = "OpenTelemetry-Instrumentation")] + public class InstrumentationEventSource : EventSource { - public static AdapterEventSource Log = new AdapterEventSource(); + public static InstrumentationEventSource Log = new InstrumentationEventSource(); [NonEvent] public void ExceptionInCustomSampler(Exception ex) diff --git a/src/OpenTelemetry/Adapter/ListenerHandler.cs b/src/OpenTelemetry/Instrumentation/ListenerHandler.cs similarity index 92% rename from src/OpenTelemetry/Adapter/ListenerHandler.cs rename to src/OpenTelemetry/Instrumentation/ListenerHandler.cs index 69970e0a22e..c70694aea33 100644 --- a/src/OpenTelemetry/Adapter/ListenerHandler.cs +++ b/src/OpenTelemetry/Instrumentation/ListenerHandler.cs @@ -16,7 +16,7 @@ using System.Diagnostics; using OpenTelemetry.Trace; -namespace OpenTelemetry.Adapter +namespace OpenTelemetry.Instrumentation { public abstract class ListenerHandler { @@ -38,7 +38,7 @@ public virtual void OnStopActivity(Activity activity, object payload) if (span == null || !span.Context.IsValid) { - AdapterEventSource.Log.NullOrBlankSpan("ListenerHandler.OnStopActivity"); + InstrumentationEventSource.Log.NullOrBlankSpan("ListenerHandler.OnStopActivity"); return; } diff --git a/src/OpenTelemetry/Properties/AssemblyInfo.cs b/src/OpenTelemetry/Properties/AssemblyInfo.cs index 9aaa67c5946..4c30388d382 100644 --- a/src/OpenTelemetry/Properties/AssemblyInfo.cs +++ b/src/OpenTelemetry/Properties/AssemblyInfo.cs @@ -17,9 +17,9 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("OpenTelemetry.Tests" + AssemblyInfo.PublicKey)] -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.Dependencies.Tests" + AssemblyInfo.PublicKey)] -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.AspNetCore.Tests" + AssemblyInfo.PublicKey)] -[assembly: InternalsVisibleTo("OpenTelemetry.Adapter.StackExchangeRedis.Tests" + AssemblyInfo.PublicKey)] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.Dependencies.Tests" + AssemblyInfo.PublicKey)] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNetCore.Tests" + AssemblyInfo.PublicKey)] +[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.StackExchangeRedis.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] #if SIGNED diff --git a/src/OpenTelemetry/Trace/Configuration/TracerBuilder.cs b/src/OpenTelemetry/Trace/Configuration/TracerBuilder.cs index 180e01955ce..f695cf464c6 100644 --- a/src/OpenTelemetry/Trace/Configuration/TracerBuilder.cs +++ b/src/OpenTelemetry/Trace/Configuration/TracerBuilder.cs @@ -37,7 +37,7 @@ internal TracerBuilder() internal List ProcessingPipelines { get; private set; } - internal List AdapterFactories { get; private set; } + internal List InstrumentationFactories { get; private set; } /// /// Configures sampler. @@ -85,30 +85,30 @@ public TracerBuilder AddProcessorPipeline(Action c } /// - /// Adds auto-adapters for spans. + /// Adds auto-instrumentations for spans. /// - /// Type of adapter class. - /// Function that builds adapter from . + /// Type of instrumentation class. + /// Function that builds instrumentation from . /// Returns for chaining. - public TracerBuilder AddAdapter( - Func adapterFactory) - where TAdapter : class + public TracerBuilder AddInstrumentation( + Func instrumentationFactory) + where TInstrumentation : class { - if (adapterFactory == null) + if (instrumentationFactory == null) { - throw new ArgumentNullException(nameof(adapterFactory)); + throw new ArgumentNullException(nameof(instrumentationFactory)); } - if (this.AdapterFactories == null) + if (this.InstrumentationFactories == null) { - this.AdapterFactories = new List(); + this.InstrumentationFactories = new List(); } - this.AdapterFactories.Add( - new AdapterFactory( - typeof(TAdapter).Name, - "semver:" + typeof(TAdapter).Assembly.GetName().Version, - adapterFactory)); + this.InstrumentationFactories.Add( + new InstrumentationFactory( + typeof(TInstrumentation).Name, + "semver:" + typeof(TInstrumentation).Assembly.GetName().Version, + instrumentationFactory)); return this; } @@ -124,13 +124,13 @@ public TracerBuilder SetTracerOptions(TracerConfiguration options) return this; } - internal readonly struct AdapterFactory + internal readonly struct InstrumentationFactory { public readonly string Name; public readonly string Version; public readonly Func Factory; - internal AdapterFactory(string name, string version, Func factory) + internal InstrumentationFactory(string name, string version, Func factory) { this.Name = name; this.Version = version; diff --git a/src/OpenTelemetry/Trace/Configuration/TracerFactory.cs b/src/OpenTelemetry/Trace/Configuration/TracerFactory.cs index 6c46c956f2a..568b712547b 100644 --- a/src/OpenTelemetry/Trace/Configuration/TracerFactory.cs +++ b/src/OpenTelemetry/Trace/Configuration/TracerFactory.cs @@ -29,7 +29,7 @@ public class TracerFactory : TracerFactoryBase, IDisposable { private readonly object lck = new object(); private readonly Dictionary tracerRegistry = new Dictionary(); - private readonly List adapters = new List(); + private readonly List instrumentations = new List(); private readonly Sampler sampler; private readonly Resource defaultResource; @@ -94,12 +94,12 @@ public static TracerFactory Create(Action configure) configure(builder); var factory = new TracerFactory(builder); - if (builder.AdapterFactories != null) + if (builder.InstrumentationFactories != null) { - foreach (var adapter in builder.AdapterFactories) + foreach (var instrumentation in builder.InstrumentationFactories) { - var tracer = factory.GetTracer(adapter.Name, adapter.Version); - factory.adapters.Add(adapter.Factory(tracer)); + var tracer = factory.GetTracer(instrumentation.Name, instrumentation.Version); + factory.instrumentations.Add(instrumentation.Factory(tracer)); } } @@ -132,7 +132,7 @@ public override Tracer GetTracer(string name, string version = null) public void Dispose() { - foreach (var item in this.adapters) + foreach (var item in this.instrumentations) { if (item is IDisposable disposable) { @@ -140,7 +140,7 @@ public void Dispose() } } - this.adapters.Clear(); + this.instrumentations.Clear(); if (this.spanProcessor is IDisposable disposableProcessor) { diff --git a/test/OpenTelemetry.Extensions.Hosting.Tests/HostingIntegrationTests.cs b/test/OpenTelemetry.Extensions.Hosting.Tests/HostingIntegrationTests.cs index 023ffdff0dd..666fcded7c8 100644 --- a/test/OpenTelemetry.Extensions.Hosting.Tests/HostingIntegrationTests.cs +++ b/test/OpenTelemetry.Extensions.Hosting.Tests/HostingIntegrationTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,19 +27,19 @@ namespace OpenTelemetry.Extensions.Hosting public class HostingIntegrationTests { [Fact] - public async Task AddOpenTelemetry_RegisterAdapter_AdapterCreatedAndDisposed() + public async Task AddOpenTelemetry_RegisterInstrumentation_InstrumentationCreatedAndDisposed() { - var testAdapter = new TestAdapter(); + var testInstrumentation = new TestInstrumentation(); var callbackRun = false; var builder = new HostBuilder().ConfigureServices(services => { services.AddOpenTelemetry(telemetry => { - telemetry.AddAdapter(t => + telemetry.AddInstrumentation(t => { callbackRun = true; - return testAdapter; + return testInstrumentation; }); }); }); @@ -47,22 +47,22 @@ public async Task AddOpenTelemetry_RegisterAdapter_AdapterCreatedAndDisposed() var host = builder.Build(); Assert.False(callbackRun); - Assert.False(testAdapter.Disposed); + Assert.False(testInstrumentation.Disposed); await host.StartAsync(); Assert.True(callbackRun); - Assert.False(testAdapter.Disposed); + Assert.False(testInstrumentation.Disposed); await host.StopAsync(); Assert.True(callbackRun); - Assert.False(testAdapter.Disposed); + Assert.False(testInstrumentation.Disposed); host.Dispose(); Assert.True(callbackRun); - Assert.True(testAdapter.Disposed); + Assert.True(testInstrumentation.Disposed); } [Fact] @@ -89,13 +89,13 @@ public void AddOpenTelemetry_HostBuilt_TracerFactoryRegisteredAsSingleton() [Fact] public void AddOpenTelemetry_ServiceProviderArgument_ServicesRegistered() { - var testAdapter = new TestAdapter(); + var testInstrumentation = new TestInstrumentation(); var services = new ServiceCollection(); - services.AddSingleton(testAdapter); + services.AddSingleton(testInstrumentation); services.AddOpenTelemetry((provider, builder) => { - builder.AddAdapter(tracer => provider.GetRequiredService()); + builder.AddInstrumentation(tracer => provider.GetRequiredService()); }); var serviceProvider = services.BuildServiceProvider(); @@ -103,14 +103,14 @@ public void AddOpenTelemetry_ServiceProviderArgument_ServicesRegistered() var tracerFactory = serviceProvider.GetRequiredService(); Assert.NotNull(tracerFactory); - Assert.False(testAdapter.Disposed); + Assert.False(testInstrumentation.Disposed); serviceProvider.Dispose(); - Assert.True(testAdapter.Disposed); + Assert.True(testInstrumentation.Disposed); } - internal class TestAdapter : IDisposable + internal class TestInstrumentation : IDisposable { public bool Disposed { get; private set; } diff --git a/test/OpenTelemetry.Adapter.AspNet.Tests/BasicTests.cs b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/BasicTests.cs similarity index 83% rename from test/OpenTelemetry.Adapter.AspNet.Tests/BasicTests.cs rename to test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/BasicTests.cs index 1afe5dd7403..dfa0fa3c419 100644 --- a/test/OpenTelemetry.Adapter.AspNet.Tests/BasicTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/BasicTests.cs @@ -18,16 +18,16 @@ using OpenTelemetry.Trace.Configuration; using Xunit; -namespace OpenTelemetry.Adapter.AspNet.Tests +namespace OpenTelemetry.Instrumentation.AspNet.Tests { public class BasicTests { [Fact] - public void AddRequestAdapter_BadArgs() + public void AddRequestInstrumentation_BadArgs() { TracerBuilder builder = null; - Assert.Throws(() => builder.AddRequestAdapter()); - Assert.Throws(() => TracerFactory.Create(b => b.AddRequestAdapter(null))); + Assert.Throws(() => builder.AddRequestInstrumentation()); + Assert.Throws(() => TracerFactory.Create(b => b.AddRequestInstrumentation(null))); } } } diff --git a/test/OpenTelemetry.Adapter.AspNet.Tests/HttpInListenerTests.cs b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/HttpInListenerTests.cs similarity index 97% rename from test/OpenTelemetry.Adapter.AspNet.Tests/HttpInListenerTests.cs rename to test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/HttpInListenerTests.cs index 1335c51c784..dbe3663db35 100644 --- a/test/OpenTelemetry.Adapter.AspNet.Tests/HttpInListenerTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/HttpInListenerTests.cs @@ -27,7 +27,7 @@ using OpenTelemetry.Trace.Export; using Xunit; -namespace OpenTelemetry.Adapter.AspNet.Tests +namespace OpenTelemetry.Instrumentation.AspNet.Tests { public class HttpInListenerTests : IDisposable { @@ -122,9 +122,9 @@ public void AspNetRequestsAreCollectedSuccessfully(string url, int routeType, st .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - using (new AspNetAdapter( + using (new AspNetInstrumentation( tracer, - new AspNetAdapterOptions + new AspNetInstrumentationOptions { RequestFilter = httpContext => { @@ -217,7 +217,7 @@ private class FakeAspNetDiagnosticSource : IDisposable public FakeAspNetDiagnosticSource() { - this.listener = new DiagnosticListener(AspNetAdapter.AspNetDiagnosticListenerName); + this.listener = new DiagnosticListener(AspNetInstrumentation.AspNetDiagnosticListenerName); } public void Write(string name, object value) diff --git a/test/OpenTelemetry.Adapter.AspNet.Tests/OpenTelemetry.Adapter.AspNet.Tests.Win.csproj b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/OpenTelemetry.Instrumentation.AspNet.Tests.Win.csproj similarity index 82% rename from test/OpenTelemetry.Adapter.AspNet.Tests/OpenTelemetry.Adapter.AspNet.Tests.Win.csproj rename to test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/OpenTelemetry.Instrumentation.AspNet.Tests.Win.csproj index 2423cd7fa8a..4f248c134c6 100644 --- a/test/OpenTelemetry.Adapter.AspNet.Tests/OpenTelemetry.Adapter.AspNet.Tests.Win.csproj +++ b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/OpenTelemetry.Instrumentation.AspNet.Tests.Win.csproj @@ -1,6 +1,6 @@  - Unit test project for OpenTelemetry ASP.NET adapter + Unit test project for OpenTelemetry ASP.NET instrumentation net46 @@ -26,7 +26,7 @@ - + diff --git a/test/OpenTelemetry.Adapter.AspNet.Tests/xunit.runner.json b/test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/xunit.runner.json similarity index 100% rename from test/OpenTelemetry.Adapter.AspNet.Tests/xunit.runner.json rename to test/OpenTelemetry.Instrumentation.AspNet.Tests.Win/xunit.runner.json diff --git a/test/OpenTelemetry.Adapter.AspNetCore.Tests/AttributesExtensions.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/AttributesExtensions.cs similarity index 94% rename from test/OpenTelemetry.Adapter.AspNetCore.Tests/AttributesExtensions.cs rename to test/OpenTelemetry.Instrumentation.AspNetCore.Tests/AttributesExtensions.cs index 97485da6d35..c8c7a883c09 100644 --- a/test/OpenTelemetry.Adapter.AspNetCore.Tests/AttributesExtensions.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/AttributesExtensions.cs @@ -17,7 +17,7 @@ using System.Collections.Generic; using System.Linq; -namespace OpenTelemetry.Adapter.AspNetCore.Tests +namespace OpenTelemetry.Instrumentation.AspNetCore.Tests { internal static class AttributesExtensions { diff --git a/test/OpenTelemetry.Adapter.AspNetCore.Tests/BasicTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs similarity index 94% rename from test/OpenTelemetry.Adapter.AspNetCore.Tests/BasicTests.cs rename to test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs index e7dc9406469..164b99d8ec7 100644 --- a/test/OpenTelemetry.Adapter.AspNetCore.Tests/BasicTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs @@ -33,7 +33,7 @@ using OpenTelemetry.Trace.Samplers; using TestApp.AspNetCore._3._1; -namespace OpenTelemetry.Adapter.AspNetCore.Tests +namespace OpenTelemetry.Instrumentation.AspNetCore.Tests { // See https://github.com/aspnet/Docs/tree/master/aspnetcore/test/integration-tests/samples/2.x/IntegrationTestsSample public class BasicTests @@ -47,11 +47,11 @@ public BasicTests(WebApplicationFactory factory) } [Fact] - public void AddRequestAdapter_BadArgs() + public void AddRequestInstrumentation_BadArgs() { TracerBuilder builder = null; - Assert.Throws(() => builder.AddRequestAdapter()); - Assert.Throws(() => TracerFactory.Create(b => b.AddRequestAdapter(null))); + Assert.Throws(() => builder.AddRequestInstrumentation()); + Assert.Throws(() => TracerFactory.Create(b => b.AddRequestInstrumentation(null))); } [Fact] @@ -65,7 +65,7 @@ void ConfigureTestServices(IServiceCollection services) TracerFactory.Create(b => b .SetSampler(new AlwaysOnSampler()) .AddProcessorPipeline(p => p.AddProcessor(n => spanProcessor.Object)) - .AddRequestAdapter())); + .AddRequestInstrumentation())); } // Arrange @@ -107,7 +107,7 @@ public async Task SuccessfulTemplateControllerCallUsesParentContext() services.AddSingleton(_ => TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(n => spanProcessor.Object)) - .AddRequestAdapter())); + .AddRequestInstrumentation())); }))) { using var client = testFactory.CreateClient(); @@ -157,7 +157,7 @@ public async Task CustomTextFormat() services.AddSingleton(_ => TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(n => spanProcessor.Object)) - .AddRequestAdapter(o => o.TextFormat = textFormat.Object))); + .AddRequestInstrumentation(o => o.TextFormat = textFormat.Object))); }))) { using var client = testFactory.CreateClient(); @@ -189,7 +189,7 @@ void ConfigureTestServices(IServiceCollection services) services.AddSingleton(_ => TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(n => spanProcessor.Object)) - .AddRequestAdapter(o => o.RequestFilter = (httpContext) => httpContext.Request.Path != "/api/values/2"))); + .AddRequestInstrumentation(o => o.RequestFilter = (httpContext) => httpContext.Request.Path != "/api/values/2"))); } // Arrange diff --git a/test/OpenTelemetry.Adapter.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs similarity index 96% rename from test/OpenTelemetry.Adapter.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs rename to test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs index d5ab4912e79..67654305f87 100644 --- a/test/OpenTelemetry.Adapter.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs @@ -27,7 +27,7 @@ using Microsoft.AspNetCore.Http; using TestApp.AspNetCore._3._1; -namespace OpenTelemetry.Adapter.AspNetCore.Tests +namespace OpenTelemetry.Instrumentation.AspNetCore.Tests { public class IncomingRequestsCollectionsIsAccordingToTheSpecTests : IClassFixture> @@ -65,7 +65,7 @@ public async Task SuccessfulTemplateControllerCallGeneratesASpan() services.AddSingleton(_ => TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(e => spanProcessor.Object)) - .AddRequestAdapter())); + .AddRequestInstrumentation())); })) .CreateClient()) { diff --git a/test/OpenTelemetry.Adapter.AspNetCore.Tests/OpenTelemetry.Adapter.AspNetCore.Tests.csproj b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj similarity index 89% rename from test/OpenTelemetry.Adapter.AspNetCore.Tests/OpenTelemetry.Adapter.AspNetCore.Tests.csproj rename to test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj index 93c002387df..32db25c926d 100644 --- a/test/OpenTelemetry.Adapter.AspNetCore.Tests/OpenTelemetry.Adapter.AspNetCore.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj @@ -1,6 +1,6 @@  - Unit test project for OpenTelemetry ASP.NET Core adapter + Unit test project for OpenTelemetry ASP.NET Core instrumentation netcoreapp3.1 @@ -26,7 +26,7 @@ - + diff --git a/test/OpenTelemetry.Adapter.AspNetCore.Tests/xunit.runner.json b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/xunit.runner.json similarity index 100% rename from test/OpenTelemetry.Adapter.AspNetCore.Tests/xunit.runner.json rename to test/OpenTelemetry.Instrumentation.AspNetCore.Tests/xunit.runner.json diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs similarity index 85% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs index 61c89ef53f2..9593795ff10 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.Basic.netcore31.cs @@ -28,7 +28,7 @@ using OpenTelemetry.Context.Propagation; using Xunit; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public partial class HttpClientTests : IDisposable { @@ -50,15 +50,15 @@ public HttpClientTests() } [Fact] - public void AddDependencyAdapter_BadArgs() + public void AddDependencyInstrumentation_BadArgs() { TracerBuilder builder = null; - Assert.Throws(() => builder.AddDependencyAdapter()); - Assert.Throws(() => builder.AddDependencyAdapter(null, null)); + Assert.Throws(() => builder.AddDependencyInstrumentation()); + Assert.Throws(() => builder.AddDependencyInstrumentation(null, null)); } [Fact] - public async Task HttpDependenciesAdapterInjectsHeadersAsync() + public async Task HttpDependenciesInstrumentationInjectsHeadersAsync() { var spanProcessor = new Mock(); var tracer = TracerFactory.Create(b => b.AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) @@ -76,7 +76,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync() parent.TraceStateString = "k1=v1,k2=v2"; parent.ActivityTraceFlags = ActivityTraceFlags.Recorded; - using (new HttpClientAdapter(tracer, new HttpClientAdapterOptions())) + using (new HttpClientInstrumentation(tracer, new HttpClientInstrumentationOptions())) { using var c = new HttpClient(); await c.SendAsync(request); @@ -100,7 +100,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync() } [Fact] - public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() + public async Task HttpDependenciesInstrumentationInjectsHeadersAsync_CustomFormat() { var textFormat = new Mock(); textFormat.Setup(m => m.Inject(It.IsAny(), It.IsAny(), It.IsAny>())) @@ -127,7 +127,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() parent.TraceStateString = "k1=v1,k2=v2"; parent.ActivityTraceFlags = ActivityTraceFlags.Recorded; - using (new HttpClientAdapter(tracer, new HttpClientAdapterOptions { TextFormat = textFormat.Object })) + using (new HttpClientInstrumentation(tracer, new HttpClientInstrumentationOptions { TextFormat = textFormat.Object })) { using var c = new HttpClient(); await c.SendAsync(request); @@ -151,13 +151,13 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() } [Fact] - public async Task HttpDependenciesAdapter_AddViaFactory_HttpAdapter_CollectsSpans() + public async Task HttpDependenciesInstrumentation_AddViaFactory_HttpInstrumentation_CollectsSpans() { var spanProcessor = new Mock(); using (TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object)) - .AddAdapter(t => new HttpClientAdapter(t)))) + .AddInstrumentation(t => new HttpClientInstrumentation(t)))) { using var c = new HttpClient(); await c.GetAsync(this.url); @@ -169,13 +169,13 @@ public async Task HttpDependenciesAdapter_AddViaFactory_HttpAdapter_CollectsSpan } [Fact] - public async Task HttpDependenciesAdapter_AddViaFactory_DependencyAdapter_CollectsSpans() + public async Task HttpDependenciesInstrumentation_AddViaFactory_DependencyInstrumentation_CollectsSpans() { var spanProcessor = new Mock(); using (TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object)) - .AddDependencyAdapter())) + .AddDependencyInstrumentation())) { using var c = new HttpClient(); await c.GetAsync(this.url); @@ -187,7 +187,7 @@ public async Task HttpDependenciesAdapter_AddViaFactory_DependencyAdapter_Collec } [Fact] - public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() + public async Task HttpDependenciesInstrumentationBacksOffIfAlreadyInstrumented() { var spanProcessor = new Mock(); var tracer = TracerFactory.Create(b => b @@ -202,7 +202,7 @@ public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() request.Headers.Add("traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"); - using (new HttpClientAdapter(tracer, new HttpClientAdapterOptions())) + using (new HttpClientInstrumentation(tracer, new HttpClientInstrumentationOptions())) { using var c = new HttpClient(); await c.SendAsync(request); @@ -212,7 +212,7 @@ public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() } [Fact] - public async Task HttpDependenciesAdapterFiltersOutRequests() + public async Task HttpDependenciesInstrumentationFiltersOutRequests() { var spanProcessor = new Mock(); @@ -220,11 +220,11 @@ public async Task HttpDependenciesAdapterFiltersOutRequests() .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - var options = new HttpClientAdapterOptions((activityName, arg1, _) => !(activityName == "System.Net.Http.HttpRequestOut" && + var options = new HttpClientInstrumentationOptions((activityName, arg1, _) => !(activityName == "System.Net.Http.HttpRequestOut" && arg1 is HttpRequestMessage request && request.RequestUri.OriginalString.Contains(this.url))); - using (new HttpClientAdapter(tracer, options)) + using (new HttpClientInstrumentation(tracer, options)) { using var c = new HttpClient(); await c.GetAsync(this.url); @@ -234,7 +234,7 @@ arg1 is HttpRequestMessage request && } [Fact] - public async Task HttpDependenciesAdapterFiltersOutRequestsToExporterEndpoints() + public async Task HttpDependenciesInstrumentationFiltersOutRequestsToExporterEndpoints() { var spanProcessor = new Mock(); @@ -242,9 +242,9 @@ public async Task HttpDependenciesAdapterFiltersOutRequestsToExporterEndpoints() .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - var options = new HttpClientAdapterOptions(); + var options = new HttpClientInstrumentationOptions(); - using (new HttpClientAdapter(tracer, options)) + using (new HttpClientInstrumentation(tracer, options)) { using var c = new HttpClient(); using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.netcore31.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.netcore31.cs similarity index 96% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.netcore31.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.netcore31.cs index fb61449c0fd..9a25928cc33 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpClientTests.netcore31.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpClientTests.netcore31.cs @@ -29,7 +29,7 @@ using System.Threading.Tasks; using Xunit; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public partial class HttpClientTests { @@ -56,7 +56,7 @@ public async Task HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOut using (serverLifeTime) - using (new HttpClientAdapter(tracer, new HttpClientAdapterOptions() { SetHttpFlavor = tc.SetHttpFlavor })) + using (new HttpClientInstrumentation(tracer, new HttpClientInstrumentationOptions() { SetHttpFlavor = tc.SetHttpFlavor })) { try { diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpTestData.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpTestData.cs similarity index 94% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpTestData.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpTestData.cs index f3aeac61fb6..a82d67b2887 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpTestData.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpTestData.cs @@ -18,7 +18,7 @@ using System.IO; using System.Reflection; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public static class HttpTestData { @@ -51,7 +51,7 @@ public static IEnumerable ReadTestCases() { var assembly = Assembly.GetExecutingAssembly(); var serializer = new JsonSerializer(); - var input = serializer.Deserialize(new JsonTextReader(new StreamReader(assembly.GetManifestResourceStream("OpenTelemetry.Adapter.Dependencies.Tests.http-out-test-cases.json")))); + var input = serializer.Deserialize(new JsonTextReader(new StreamReader(assembly.GetManifestResourceStream("OpenTelemetry.Instrumentation.Dependencies.Tests.http-out-test-cases.json")))); return GetArgumentsFromTestCaseObject(input); } diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs similarity index 99% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs index 1d987dc7aa5..66268b44b66 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestDiagnosticSourceTests.net461.cs @@ -28,9 +28,9 @@ using Xunit; using OpenTelemetry.Internal.Test; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public class HttpWebRequestDiagnosticSourceTests : IDisposable { @@ -902,7 +902,7 @@ private static void VerifyHeaders(HttpWebRequest startRequest) } /// - /// CallbackObserver is an adapter class that creates an observer (which you can pass + /// CallbackObserver is an instrumentation class that creates an observer (which you can pass /// to IObservable.Subscribe), and calls the given callback every time the 'next' /// operation on the IObserver happens. /// diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs similarity index 85% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs index f5ed4f7ad66..c05bb0d147f 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.Basic.net461.cs @@ -26,10 +26,10 @@ using OpenTelemetry.Trace; using OpenTelemetry.Trace.Configuration; using OpenTelemetry.Trace.Export; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using Xunit; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public partial class HttpWebRequestTests : IDisposable { @@ -60,7 +60,7 @@ public void Dispose() } [Fact] - public async Task HttpDependenciesAdapterInjectsHeadersAsync() + public async Task HttpDependenciesInstrumentationInjectsHeadersAsync() { var spanProcessor = new Mock(); var tracer = TracerFactory.Create(b => b.AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) @@ -76,7 +76,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync() parent.TraceStateString = "k1=v1,k2=v2"; parent.ActivityTraceFlags = ActivityTraceFlags.Recorded; - using (new HttpWebRequestAdapter(tracer, new HttpClientAdapterOptions())) + using (new HttpWebRequestInstrumentation(tracer, new HttpClientInstrumentationOptions())) { using var response = await request.GetResponseAsync(); } @@ -99,7 +99,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync() } [Fact] - public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() + public async Task HttpDependenciesInstrumentationInjectsHeadersAsync_CustomFormat() { var textFormat = new Mock(); textFormat.Setup(m => m.Inject(It.IsAny(), It.IsAny(), It.IsAny>())) @@ -124,7 +124,7 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() parent.TraceStateString = "k1=v1,k2=v2"; parent.ActivityTraceFlags = ActivityTraceFlags.Recorded; - using (new HttpWebRequestAdapter(tracer, new HttpClientAdapterOptions { TextFormat = textFormat.Object })) + using (new HttpWebRequestInstrumentation(tracer, new HttpClientInstrumentationOptions { TextFormat = textFormat.Object })) { using var response = await request.GetResponseAsync(); } @@ -148,13 +148,13 @@ public async Task HttpDependenciesAdapterInjectsHeadersAsync_CustomFormat() } [Fact] - public async Task HttpDependenciesAdapter_AddViaFactory_HttpAdapter_CollectsSpans() + public async Task HttpDependenciesInstrumentation_AddViaFactory_HttpInstrumentation_CollectsSpans() { var spanProcessor = new Mock(); using (TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object)) - .AddAdapter(t => new HttpWebRequestAdapter(t)))) + .AddInstrumentation(t => new HttpWebRequestInstrumentation(t)))) { using var c = new HttpClient(); await c.GetAsync(this.url); @@ -166,13 +166,13 @@ public async Task HttpDependenciesAdapter_AddViaFactory_HttpAdapter_CollectsSpan } [Fact] - public async Task HttpDependenciesAdapter_AddViaFactory_DependencyAdapter_CollectsSpans() + public async Task HttpDependenciesInstrumentation_AddViaFactory_DependencyInstrumentation_CollectsSpans() { var spanProcessor = new Mock(); using (TracerFactory.Create(b => b .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object)) - .AddDependencyAdapter())) + .AddDependencyInstrumentation())) { using var c = new HttpClient(); await c.GetAsync(this.url); @@ -184,7 +184,7 @@ public async Task HttpDependenciesAdapter_AddViaFactory_DependencyAdapter_Collec } [Fact] - public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() + public async Task HttpDependenciesInstrumentationBacksOffIfAlreadyInstrumented() { var spanProcessor = new Mock(); var tracer = TracerFactory.Create(b => b @@ -199,7 +199,7 @@ public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() request.Headers.Add("traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"); - using (new HttpWebRequestAdapter(tracer, new HttpClientAdapterOptions())) + using (new HttpWebRequestInstrumentation(tracer, new HttpClientInstrumentationOptions())) { using var c = new HttpClient(); await c.SendAsync(request); @@ -209,7 +209,7 @@ public async Task HttpDependenciesAdapterBacksOffIfAlreadyInstrumented() } [Fact] - public async Task HttpDependenciesAdapterFiltersOutRequests() + public async Task HttpDependenciesInstrumentationFiltersOutRequests() { var spanProcessor = new Mock(); @@ -217,12 +217,12 @@ public async Task HttpDependenciesAdapterFiltersOutRequests() .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - var options = new HttpClientAdapterOptions((activityName, arg1, _) + var options = new HttpClientInstrumentationOptions((activityName, arg1, _) => !(activityName == HttpWebRequestDiagnosticSource.ActivityName && arg1 is HttpWebRequest request && request.RequestUri.OriginalString.Contains(this.url))); - using (new HttpWebRequestAdapter(tracer, options)) + using (new HttpWebRequestInstrumentation(tracer, options)) { using var c = new HttpClient(); await c.GetAsync(this.url); diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.net461.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.net461.cs similarity index 96% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.net461.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.net461.cs index 1575e2ae7d0..4227ee35e8a 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/HttpWebRequestTests.net461.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/HttpWebRequestTests.net461.cs @@ -27,7 +27,7 @@ using OpenTelemetry.Trace.Export; using Xunit; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public partial class HttpWebRequestTests { @@ -52,7 +52,7 @@ public void HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOutTestCa .GetTracer(null); tc.Url = HttpTestData.NormalizeValues(tc.Url, host, port); - using (new HttpWebRequestAdapter(tracer, new HttpClientAdapterOptions() { SetHttpFlavor = tc.SetHttpFlavor })) + using (new HttpWebRequestInstrumentation(tracer, new HttpClientInstrumentationOptions() { SetHttpFlavor = tc.SetHttpFlavor })) { try { diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/OpenTelemetry.Adapter.Dependencies.Tests.csproj b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/OpenTelemetry.Instrumentation.Dependencies.Tests.csproj similarity index 90% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/OpenTelemetry.Adapter.Dependencies.Tests.csproj rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/OpenTelemetry.Instrumentation.Dependencies.Tests.csproj index 1fda297ffbb..4239bf51fd7 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/OpenTelemetry.Adapter.Dependencies.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/OpenTelemetry.Instrumentation.Dependencies.Tests.csproj @@ -1,6 +1,6 @@  - Unit test project for OpenTelemetry dependency adapters + Unit test project for OpenTelemetry dependency instrumentations netcoreapp3.1 $(TargetFrameworks);net461 @@ -38,7 +38,7 @@ - + diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/SqlClientTests.cs b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/SqlClientTests.cs similarity index 96% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/SqlClientTests.cs rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/SqlClientTests.cs index 065d6e7af9f..6264da79aa7 100644 --- a/test/OpenTelemetry.Adapter.Dependencies.Tests/SqlClientTests.cs +++ b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/SqlClientTests.cs @@ -20,13 +20,13 @@ using System.Linq; using Microsoft.Data.SqlClient; using Moq; -using OpenTelemetry.Adapter.Dependencies.Implementation; +using OpenTelemetry.Instrumentation.Dependencies.Implementation; using OpenTelemetry.Trace; using OpenTelemetry.Trace.Configuration; using OpenTelemetry.Trace.Export; using Xunit; -namespace OpenTelemetry.Adapter.Dependencies.Tests +namespace OpenTelemetry.Instrumentation.Dependencies.Tests { public class SqlClientTests : IDisposable { @@ -65,9 +65,9 @@ public void SqlClientCallsAreCollectedSuccessfully( .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - using (new SqlClientAdapter( + using (new SqlClientInstrumentation( tracer, - new SqlClientAdapterOptions + new SqlClientInstrumentationOptions { CaptureStoredProcedureCommandName = captureStoredProcedureCommandName, CaptureTextCommandContent = captureTextCommandContent, @@ -168,7 +168,7 @@ public void SqlClientErrorsAreCollectedSuccessfully(string beforeCommand, string .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - using (new SqlClientAdapter(tracer)) + using (new SqlClientInstrumentation(tracer)) { var operationId = Guid.NewGuid(); var sqlConnection = new SqlConnection(TestConnectionString); @@ -229,7 +229,7 @@ private class FakeSqlClientDiagnosticSource : IDisposable public FakeSqlClientDiagnosticSource() { - this.listener = new DiagnosticListener(SqlClientAdapter.SqlClientDiagnosticListenerName); + this.listener = new DiagnosticListener(SqlClientInstrumentation.SqlClientDiagnosticListenerName); } public void Write(string name, object value) diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/http-out-test-cases.json b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/http-out-test-cases.json similarity index 100% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/http-out-test-cases.json rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/http-out-test-cases.json diff --git a/test/OpenTelemetry.Adapter.Dependencies.Tests/xunit.runner.json b/test/OpenTelemetry.Instrumentation.Dependencies.Tests/xunit.runner.json similarity index 100% rename from test/OpenTelemetry.Adapter.Dependencies.Tests/xunit.runner.json rename to test/OpenTelemetry.Instrumentation.Dependencies.Tests/xunit.runner.json diff --git a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/AttributesExtensions.cs b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/AttributesExtensions.cs similarity index 93% rename from test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/AttributesExtensions.cs rename to test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/AttributesExtensions.cs index 83cbba8cfd7..6e8e75f74bf 100644 --- a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/AttributesExtensions.cs +++ b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/AttributesExtensions.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Collections.Generic; -namespace OpenTelemetry.Adapter.StackExchangeRedis.Tests +namespace OpenTelemetry.Instrumentation.StackExchangeRedis.Tests { internal static class AttributesExtensions { diff --git a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs similarity index 94% rename from test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs rename to test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs index b2d861416e8..c3d6a65231d 100644 --- a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs +++ b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToSpanConverterTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,13 +17,13 @@ using System; using Moq; -using OpenTelemetry.Adapter.StackExchangeRedis.Tests; +using OpenTelemetry.Instrumentation.StackExchangeRedis.Tests; using OpenTelemetry.Trace; using OpenTelemetry.Trace.Configuration; using StackExchange.Redis.Profiling; using Xunit; -namespace OpenTelemetry.Adapter.StackExchangeRedis.Implementation +namespace OpenTelemetry.Instrumentation.StackExchangeRedis.Implementation { public class RedisProfilerEntryToSpanConverterTests { diff --git a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/OpenTelemetry.Adapter.StackExchangeRedis.Tests.csproj b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj similarity index 83% rename from test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/OpenTelemetry.Adapter.StackExchangeRedis.Tests.csproj rename to test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj index 4e4ad869316..5b523e1f81d 100644 --- a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/OpenTelemetry.Adapter.StackExchangeRedis.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj @@ -1,12 +1,12 @@  - Unit test project for OpenTelemetry StackExchangeRedis adapter + Unit test project for OpenTelemetry StackExchangeRedis instrumentation netcoreapp3.1 $(TargetFrameworks);net461 - + diff --git a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/StackExchangeRedisCallsAdapterTests.cs b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/StackExchangeRedisCallsInstrumentationTests.cs similarity index 78% rename from test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/StackExchangeRedisCallsAdapterTests.cs rename to test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/StackExchangeRedisCallsInstrumentationTests.cs index 7850f582ef5..cc427c9bd6d 100644 --- a/test/OpenTelemetry.Adapter.StackExchangeRedis.Tests/StackExchangeRedisCallsAdapterTests.cs +++ b/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/StackExchangeRedisCallsInstrumentationTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,9 +21,9 @@ using System.Threading.Tasks; using Xunit; -namespace OpenTelemetry.Adapter.StackExchangeRedis +namespace OpenTelemetry.Instrumentation.StackExchangeRedis { - public class StackExchangeRedisCallsAdapterTests + public class StackExchangeRedisCallsInstrumentationTests { [Fact] public async void ProfilerSessionUsesTheSameDefault() @@ -33,8 +33,8 @@ public async void ProfilerSessionUsesTheSameDefault() .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object))) .GetTracer(null); - using var adapter = new StackExchangeRedisCallsAdapter(tracer); - var profilerFactory = adapter.GetProfilerSessionsFactory(); + using var instrumentation = new StackExchangeRedisCallsInstrumentation(tracer); + var profilerFactory = instrumentation.GetProfilerSessionsFactory(); var first = profilerFactory(); var second = profilerFactory(); diff --git a/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerBuilderTests.cs b/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerBuilderTests.cs index ef99e46757d..021c2a4b9b8 100644 --- a/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerBuilderTests.cs +++ b/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerBuilderTests.cs @@ -35,7 +35,7 @@ public void TracerBuilder_BadArgs() Assert.Throws(() => new TracerBuilder().SetSampler(null)); Assert.Throws(() => new TracerBuilder().AddProcessorPipeline(null)); Assert.Throws(() => new TracerBuilder().SetTracerOptions(null)); - Assert.Throws(() => new TracerBuilder().AddAdapter(null)); + Assert.Throws(() => new TracerBuilder().AddInstrumentation(null)); } [Fact] @@ -45,7 +45,7 @@ public void TracerBuilder_Defaults() Assert.Null(builder.Sampler); Assert.Null(builder.ProcessingPipelines); Assert.Null(builder.TracerConfigurationOptions); - Assert.Null(builder.AdapterFactories); + Assert.Null(builder.InstrumentationFactories); } [Fact] @@ -54,7 +54,7 @@ public void TracerBuilder_ValidArgs() var builder = new TracerBuilder(); bool processorFactoryCalled = false; - bool adapterFactoryCalled = true; + bool instrumentationFactoryCalled = true; var sampler = new ProbabilitySampler(0.1); var exporter = new TestExporter(_ => { }); @@ -71,10 +71,10 @@ public void TracerBuilder_ValidArgs() return new SimpleSpanProcessor(e); })) .SetTracerOptions(options) - .AddAdapter(t => + .AddInstrumentation(t => { Assert.NotNull(t); - return new TestAdapter(t); + return new TestInstrumentation(t); }); Assert.Same(sampler, builder.Sampler); @@ -87,22 +87,22 @@ public void TracerBuilder_ValidArgs() Assert.True(processorFactoryCalled); Assert.Same(options, builder.TracerConfigurationOptions); - Assert.Single(builder.AdapterFactories); + Assert.Single(builder.InstrumentationFactories); - var adapterFactory = builder.AdapterFactories.Single(); - Assert.Equal(nameof(TestAdapter), adapterFactory.Name); - Assert.Equal("semver:" + typeof(TestAdapter).Assembly.GetName().Version, adapterFactory.Version); + var instrumentationFactory = builder.InstrumentationFactories.Single(); + Assert.Equal(nameof(TestInstrumentation), instrumentationFactory.Name); + Assert.Equal("semver:" + typeof(TestInstrumentation).Assembly.GetName().Version, instrumentationFactory.Version); - Assert.NotNull(adapterFactory.Factory); - adapterFactory.Factory(new TracerSdk(new SimpleSpanProcessor(exporter), new AlwaysOnSampler(), options, Resource.Empty)); + Assert.NotNull(instrumentationFactory.Factory); + instrumentationFactory.Factory(new TracerSdk(new SimpleSpanProcessor(exporter), new AlwaysOnSampler(), options, Resource.Empty)); - Assert.True(adapterFactoryCalled); + Assert.True(instrumentationFactoryCalled); } - private class TestAdapter + private class TestInstrumentation { private readonly Tracer tracer; - public TestAdapter(Tracer tracer) + public TestInstrumentation(Tracer tracer) { this.tracer = tracer; } diff --git a/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerFactoryTest.cs b/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerFactoryTest.cs index 90ff5a1db31..a0b6b8ea26f 100644 --- a/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerFactoryTest.cs +++ b/test/OpenTelemetry.Tests/Implementation/Trace/Config/TracerFactoryTest.cs @@ -65,8 +65,8 @@ public void CreateFactory_BuilderWithArgs() Assert.IsType(spans.Single()); }); - TestAdapter adapter1 = null; - TestAdapter adapter2 = null; + TestInstrumentation instrumentation1 = null; + TestInstrumentation instrumentation2 = null; TestProcessor processor = null; var tracerFactory = TracerFactory.Create(b => b .AddProcessorPipeline(p => p @@ -76,15 +76,15 @@ public void CreateFactory_BuilderWithArgs() processor = new TestProcessor(e); return processor; })) - .AddAdapter(t => + .AddInstrumentation(t => { - adapter1 = new TestAdapter(t); - return adapter1; + instrumentation1 = new TestInstrumentation(t); + return instrumentation1; }) - .AddAdapter(t => + .AddInstrumentation(t => { - adapter2 = new TestAdapter(t); - return adapter2; + instrumentation2 = new TestInstrumentation(t); + return instrumentation2; })); var tracer = tracerFactory.GetTracer("my-app"); @@ -97,26 +97,26 @@ public void CreateFactory_BuilderWithArgs() Assert.Single(((SpanSdk)span).LibraryResource.Attributes); Assert.Single(((SpanSdk)span).LibraryResource.Attributes.Where(kvp => kvp.Key == "name" && kvp.Value.ToString() == "my-app")); - Assert.NotNull(adapter1); - Assert.NotNull(adapter2); + Assert.NotNull(instrumentation1); + Assert.NotNull(instrumentation2); Assert.NotNull(processor); - var span1 = adapter1.Collect(); - var span2 = adapter1.Collect(); + var span1 = instrumentation1.Collect(); + var span2 = instrumentation1.Collect(); Assert.Equal(3, exporterCalledCount); Assert.Equal(2, span1.LibraryResource.Attributes.Count()); Assert.Equal(2, span2.LibraryResource.Attributes.Count()); - Assert.Single(span1.LibraryResource.Attributes.Where(kvp => kvp.Key == "name" && kvp.Value is string sv && sv == "TestAdapter")); - Assert.Single(span2.LibraryResource.Attributes.Where(kvp => kvp.Key == "name" && kvp.Value is string sv && sv == "TestAdapter")); + Assert.Single(span1.LibraryResource.Attributes.Where(kvp => kvp.Key == "name" && kvp.Value is string sv && sv == "TestInstrumentation")); + Assert.Single(span2.LibraryResource.Attributes.Where(kvp => kvp.Key == "name" && kvp.Value is string sv && sv == "TestInstrumentation")); Assert.Single(span1.LibraryResource.Attributes.Where(kvp => kvp.Key == "version" && kvp.Value is string sv && sv == "semver:1.0.0.0")); Assert.Single(span2.LibraryResource.Attributes.Where(kvp => kvp.Key == "version" && kvp.Value is string sv && sv == "semver:1.0.0.0")); tracerFactory.Dispose(); - Assert.True(adapter1.IsDisposed); - Assert.True(adapter2.IsDisposed); + Assert.True(instrumentation1.IsDisposed); + Assert.True(instrumentation2.IsDisposed); Assert.True(processor.IsDisposed); } @@ -281,12 +281,12 @@ public override Task ShutdownAsync(CancellationToken cancellationToken) } } - private class TestAdapter : IDisposable + private class TestInstrumentation : IDisposable { private readonly Tracer tracer; public bool IsDisposed { get; private set; } - public TestAdapter(Tracer tracer) + public TestInstrumentation(Tracer tracer) { this.tracer = tracer; } diff --git a/test/TestApp.AspNetCore.3.1/Startup.cs b/test/TestApp.AspNetCore.3.1/Startup.cs index 45760e5ac8d..7f98715dfd1 100644 --- a/test/TestApp.AspNetCore.3.1/Startup.cs +++ b/test/TestApp.AspNetCore.3.1/Startup.cs @@ -43,8 +43,8 @@ public void ConfigureServices(IServiceCollection services) new CallbackMiddleware.CallbackMiddlewareImpl()); services.TryAddSingleton(_ => TracerFactory.Create(b => b - .AddRequestAdapter() - .AddDependencyAdapter())); + .AddRequestInstrumentation() + .AddDependencyInstrumentation())); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj b/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj index b34f4105ed2..7726f1a75d1 100644 --- a/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj +++ b/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj @@ -16,8 +16,8 @@ - - + +