diff --git a/src/OpenTelemetry.Extensions.Hosting/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Extensions.Hosting/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 5e8365829f9..3812863f17c 100644 --- a/src/OpenTelemetry.Extensions.Hosting/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Extensions.Hosting/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,5 +1,4 @@ Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions -OpenTelemetry.Metrics.MeterProviderBuilderExtensions OpenTelemetry.OpenTelemetryBuilder OpenTelemetry.OpenTelemetryBuilder.ConfigureResource(System.Action! configure) -> OpenTelemetry.OpenTelemetryBuilder! OpenTelemetry.OpenTelemetryBuilder.Services.get -> Microsoft.Extensions.DependencyInjection.IServiceCollection! @@ -7,13 +6,5 @@ OpenTelemetry.OpenTelemetryBuilder.WithMetrics() -> OpenTelemetry.OpenTelemetryB OpenTelemetry.OpenTelemetryBuilder.WithMetrics(System.Action! configure) -> OpenTelemetry.OpenTelemetryBuilder! OpenTelemetry.OpenTelemetryBuilder.WithTracing() -> OpenTelemetry.OpenTelemetryBuilder! OpenTelemetry.OpenTelemetryBuilder.WithTracing(System.Action! configure) -> OpenTelemetry.OpenTelemetryBuilder! -OpenTelemetry.Trace.TracerProviderBuilderExtensions static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetry(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> OpenTelemetry.OpenTelemetryBuilder! -static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetryMetrics(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetryMetrics(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action! configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetryTracing(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetryTracing(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action! configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.Configure(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder! -static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.GetServices(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.Configure(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action! configure) -> OpenTelemetry.Trace.TracerProviderBuilder! -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.GetServices(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! + diff --git a/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md b/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md index 8ab3122a182..480d06e5918 100644 --- a/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md +++ b/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +* Removed deprecated extensions: `AddOpenTelemetryTracing`, + `AddOpenTelemetryMetrics`, `Configure`, & `GetServices`. + ([#4071](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4071)) + ## 1.4.0-rc.4 Released 2023-Feb-10 diff --git a/src/OpenTelemetry.Extensions.Hosting/Metrics/MeterProviderBuilderExtensions.cs b/src/OpenTelemetry.Extensions.Hosting/Metrics/MeterProviderBuilderExtensions.cs deleted file mode 100644 index e2af1280573..00000000000 --- a/src/OpenTelemetry.Extensions.Hosting/Metrics/MeterProviderBuilderExtensions.cs +++ /dev/null @@ -1,70 +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 Microsoft.Extensions.DependencyInjection; -using OpenTelemetry.Internal; - -namespace OpenTelemetry.Metrics -{ - /// - /// Contains extension methods for the class. - /// - public static class MeterProviderBuilderExtensions - { - /// - /// Register a callback action to configure the once the application is available. - /// - /// . - /// Configuration callback. - /// The supplied for chaining. - [Obsolete("Configure has been replaced by factory extensions. This method will be removed in a future version.")] - public static MeterProviderBuilder Configure(this MeterProviderBuilder meterProviderBuilder, Action configure) - { - if (meterProviderBuilder is IDeferredMeterProviderBuilder deferredMeterProviderBuilder) - { - deferredMeterProviderBuilder.Configure(configure); - } - - return meterProviderBuilder; - } - - /// - /// Gets the application attached to - /// the . - /// - /// . - /// or - /// if services are unavailable. - [Obsolete("Call ConfigureServices instead this method will be removed in a future version.")] - public static IServiceCollection GetServices(this MeterProviderBuilder meterProviderBuilder) - { - Guard.ThrowIfNull(meterProviderBuilder); - - IServiceCollection? services = null; - - meterProviderBuilder.ConfigureServices(s => services = s); - - if (services == null) - { - throw new NotSupportedException($"GetServices is not supported on the '{meterProviderBuilder.GetType()}' builder type."); - } - - return services; - } - } -} diff --git a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryServicesExtensions.cs b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryServicesExtensions.cs index 7ebc142b358..dff14ca1b38 100644 --- a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryServicesExtensions.cs +++ b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetryServicesExtensions.cs @@ -52,102 +52,4 @@ public static OpenTelemetryBuilder AddOpenTelemetry(this IServiceCollection serv return new(services); } - - /// - /// Configure OpenTelemetry and register a - /// to automatically start tracing services in the supplied . - /// - /// - /// Notes: - /// - /// - /// This is safe to be called multiple times. Only a single will be created for a given . - /// - /// - /// This method should be called by application host code. Library - /// authors should call - /// instead. - /// - /// - /// - /// . - /// Supplied for chaining - /// calls. - [Obsolete("Use the AddOpenTelemetry().WithTracing(configure) pattern instead. This method will be removed in a future version.")] - public static IServiceCollection AddOpenTelemetryTracing(this IServiceCollection services) - => AddOpenTelemetryTracing(services, b => { }); - - /// - /// Configure OpenTelemetry and register a - /// to automatically start tracing services in the supplied . - /// - /// - /// . - /// Callback action to configure the . - /// Supplied for chaining - /// calls. - [Obsolete("Use the AddOpenTelemetry().WithTracing(configure) pattern instead. This method will be removed in a future version.")] - public static IServiceCollection AddOpenTelemetryTracing(this IServiceCollection services, Action configure) - { - services.AddOpenTelemetry().WithTracing(configure); - - return services; - } - - /// - /// Configure OpenTelemetry and register a - /// to automatically start metric services in the supplied . - /// - /// - /// Notes: - /// - /// - /// This is safe to be called multiple times. Only a single will be created for a given . - /// - /// - /// This method should be called by application host code. Library - /// authors should call - /// instead. - /// - /// - /// - /// . - /// Supplied for chaining - /// calls. - [Obsolete("Use the AddOpenTelemetry().WithMetrics(configure) pattern instead. This method will be removed in a future version.")] - public static IServiceCollection AddOpenTelemetryMetrics(this IServiceCollection services) - => AddOpenTelemetryMetrics(services, b => { }); - - /// - /// Configure OpenTelemetry and register a - /// to automatically start metric services in the supplied . - /// - /// - /// . - /// Callback action to configure the . - /// Supplied for chaining - /// calls. - [Obsolete("Use the AddOpenTelemetry().WithMetrics(configure) pattern instead. This method will be removed in a future version.")] - public static IServiceCollection AddOpenTelemetryMetrics(this IServiceCollection services, Action configure) - { - services.AddOpenTelemetry().WithMetrics(configure); - - return services; - } } diff --git a/src/OpenTelemetry.Extensions.Hosting/Trace/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Extensions.Hosting/Trace/TracerProviderBuilderExtensions.cs deleted file mode 100644 index 55e6629c8a7..00000000000 --- a/src/OpenTelemetry.Extensions.Hosting/Trace/TracerProviderBuilderExtensions.cs +++ /dev/null @@ -1,70 +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 Microsoft.Extensions.DependencyInjection; -using OpenTelemetry.Internal; - -namespace OpenTelemetry.Trace -{ - /// - /// Contains extension methods for the class. - /// - public static class TracerProviderBuilderExtensions - { - /// - /// Register a callback action to configure the once the application is available. - /// - /// . - /// Configuration callback. - /// The supplied for chaining. - [Obsolete("Configure has been replaced by factory extensions. This method will be removed in a future version.")] - public static TracerProviderBuilder Configure(this TracerProviderBuilder tracerProviderBuilder, Action configure) - { - if (tracerProviderBuilder is IDeferredTracerProviderBuilder deferredTracerProviderBuilder) - { - deferredTracerProviderBuilder.Configure(configure); - } - - return tracerProviderBuilder; - } - - /// - /// Gets the application attached to - /// the . - /// - /// . - /// or - /// if services are unavailable. - [Obsolete("Call ConfigureServices instead this method will be removed in a future version.")] - public static IServiceCollection GetServices(this TracerProviderBuilder tracerProviderBuilder) - { - Guard.ThrowIfNull(tracerProviderBuilder); - - IServiceCollection? services = null; - - tracerProviderBuilder.ConfigureServices(s => services = s); - - if (services == null) - { - throw new NotSupportedException($"GetServices is not supported on the '{tracerProviderBuilder.GetType()}' builder type."); - } - - return services; - } - } -}