From b710c314ae041ad5db655cce4547f921b88e7495 Mon Sep 17 00:00:00 2001 From: Alan West <3676547+alanwest@users.noreply.github.com> Date: Wed, 18 Nov 2020 11:26:22 -0800 Subject: [PATCH] Use consistent pattern for namespace of extension methods (#1576) * Change PrometheusRouteBuilderExtensions namespace to Microsoft.AspNetCore.Builder * Change ConsoleExporterLoggingExtensions namespace to OpenTelemetry.Logs * Change namespace in example app * Change namespace of extension methods for InMemoryExporter * Change ResourceBuilderExtensions namespace to OpenTelemetry.Resources * Add comment for extension methods not contained in namespace of type they are extending * Update comment * Update changelog Co-authored-by: Cijo Thomas --- docs/logs/getting-started/Program.cs | 2 +- src/OpenTelemetry.Api/ActivityContextExtensions.cs | 5 +++++ src/OpenTelemetry.Api/Trace/ActivityExtensions.cs | 5 +++++ .../.publicApi/net452/PublicAPI.Unshipped.txt | 2 +- .../.publicApi/net461/PublicAPI.Unshipped.txt | 4 ++-- .../.publicApi/netstandard2.0/PublicAPI.Unshipped.txt | 4 ++-- src/OpenTelemetry.Exporter.Console/CHANGELOG.md | 4 ++++ .../ConsoleExporterLoggingExtensions.cs | 3 +-- .../.publicApi/net452/PublicAPI.Unshipped.txt | 4 ++-- .../.publicApi/net46/PublicAPI.Unshipped.txt | 4 ++-- .../.publicApi/net461/PublicAPI.Unshipped.txt | 8 ++++---- .../.publicApi/netstandard2.0/PublicAPI.Unshipped.txt | 8 ++++---- src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md | 7 +++++++ .../InMemoryExporterHelperExtensions.cs | 3 +-- .../InMemoryExporterLoggingExtensions.cs | 4 +--- .../.publicApi/netstandard2.0/PublicAPI.Unshipped.txt | 6 +++--- src/OpenTelemetry.Exporter.Prometheus/CHANGELOG.md | 5 +++++ .../PrometheusRouteBuilderExtensions.cs | 4 ++-- .../.publicApi/net452/PublicAPI.Unshipped.txt | 10 +++++----- .../.publicApi/net46/PublicAPI.Unshipped.txt | 10 +++++----- .../.publicApi/net461/PublicAPI.Unshipped.txt | 10 +++++----- .../.publicApi/netstandard2.0/PublicAPI.Unshipped.txt | 10 +++++----- src/OpenTelemetry/CHANGELOG.md | 6 ++++++ .../Resources/ResourceBuilderExtensions.cs | 3 +-- .../PrometheusExporterTests.cs | 1 + 25 files changed, 80 insertions(+), 52 deletions(-) diff --git a/docs/logs/getting-started/Program.cs b/docs/logs/getting-started/Program.cs index a86fee8f39f..57fc6616e27 100644 --- a/docs/logs/getting-started/Program.cs +++ b/docs/logs/getting-started/Program.cs @@ -14,11 +14,11 @@ // limitations under the License. // -using OpenTelemetry.Trace; #if NETCOREAPP2_1 using Microsoft.Extensions.DependencyInjection; #endif using Microsoft.Extensions.Logging; +using OpenTelemetry.Logs; public class Program { diff --git a/src/OpenTelemetry.Api/ActivityContextExtensions.cs b/src/OpenTelemetry.Api/ActivityContextExtensions.cs index 4bd5f92d541..408d0bea562 100644 --- a/src/OpenTelemetry.Api/ActivityContextExtensions.cs +++ b/src/OpenTelemetry.Api/ActivityContextExtensions.cs @@ -16,6 +16,11 @@ using System.Diagnostics; +// The ActivityContext class is in the System.Diagnostics namespace. +// These extension methods on ActivityContext are intentionally not placed in the +// same namespace as Activity to prevent name collisions in the future. +// The OpenTelemetry namespace is used because ActivityContext applies to all types +// of telemetry data - i.e. traces, metrics, and logs. namespace OpenTelemetry { /// diff --git a/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs b/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs index 4f8e2b07287..fa22eb50fc6 100644 --- a/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs +++ b/src/OpenTelemetry.Api/Trace/ActivityExtensions.cs @@ -19,6 +19,11 @@ using System.Runtime.CompilerServices; using OpenTelemetry.Internal; +// The Activity class is in the System.Diagnostics namespace. +// These extension methods on Activity are intentionally not placed in the +// same namespace as Activity to prevent name collisions in the future. +// The OpenTelemetry.Trace namespace is used because Activity is analogous +// to Span in OpenTelemetry. namespace OpenTelemetry.Trace { /// diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/net452/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/net452/PublicAPI.Unshipped.txt index 11ba61463b0..c0cee5a321d 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/net452/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/net452/PublicAPI.Unshipped.txt @@ -9,4 +9,4 @@ OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Console = 1 -> OpenTelemetry OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Debug = 2 -> OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Trace.ConsoleExporterHelperExtensions override OpenTelemetry.Exporter.ConsoleExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult -static OpenTelemetry.Trace.ConsoleExporterHelperExtensions.AddConsoleExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure = null) -> OpenTelemetry.Trace.TracerProviderBuilder \ No newline at end of file +static OpenTelemetry.Trace.ConsoleExporterHelperExtensions.AddConsoleExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure = null) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/net461/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/net461/PublicAPI.Unshipped.txt index 378445a343d..1c2dc8f8104 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/net461/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/net461/PublicAPI.Unshipped.txt @@ -8,7 +8,7 @@ OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Console = 1 -> OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Debug = 2 -> OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Trace.ConsoleExporterHelperExtensions -OpenTelemetry.Trace.ConsoleExporterLoggingExtensions +OpenTelemetry.Logs.ConsoleExporterLoggingExtensions override OpenTelemetry.Exporter.ConsoleExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult static OpenTelemetry.Trace.ConsoleExporterHelperExtensions.AddConsoleExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure = null) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.ConsoleExporterLoggingExtensions.AddConsoleExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action configure = null) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions +static OpenTelemetry.Logs.ConsoleExporterLoggingExtensions.AddConsoleExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action configure = null) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 378445a343d..1c2dc8f8104 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -8,7 +8,7 @@ OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Console = 1 -> OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Exporter.ConsoleExporterOutputTargets.Debug = 2 -> OpenTelemetry.Exporter.ConsoleExporterOutputTargets OpenTelemetry.Trace.ConsoleExporterHelperExtensions -OpenTelemetry.Trace.ConsoleExporterLoggingExtensions +OpenTelemetry.Logs.ConsoleExporterLoggingExtensions override OpenTelemetry.Exporter.ConsoleExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult static OpenTelemetry.Trace.ConsoleExporterHelperExtensions.AddConsoleExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure = null) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.ConsoleExporterLoggingExtensions.AddConsoleExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action configure = null) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions +static OpenTelemetry.Logs.ConsoleExporterLoggingExtensions.AddConsoleExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action configure = null) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index da194be9779..b786471f50d 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +* `AddConsoleExporter` extension method for logs moved from + `OpenTelemetry.Trace` namespace to `OpenTelemetry.Logs` namespace. + ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) + ## 1.0.0-rc1.1 Released 2020-Nov-17 diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs index 3b138f6a987..1827cc90c50 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs @@ -17,9 +17,8 @@ #if NET461 || NETSTANDARD2_0 using System; using OpenTelemetry.Exporter; -using OpenTelemetry.Logs; -namespace OpenTelemetry.Trace +namespace OpenTelemetry.Logs { public static class ConsoleExporterLoggingExtensions { diff --git a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net452/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net452/PublicAPI.Unshipped.txt index f700d27e57c..88e363cc43a 100644 --- a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net452/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net452/PublicAPI.Unshipped.txt @@ -1,5 +1,5 @@ OpenTelemetry.Exporter.InMemoryExporter OpenTelemetry.Exporter.InMemoryExporter.InMemoryExporter(System.Collections.Generic.ICollection exportedItems) -> void -OpenTelemetry.InMemoryExporterHelperExtensions +OpenTelemetry.Trace.InMemoryExporterHelperExtensions override OpenTelemetry.Exporter.InMemoryExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult -static OpenTelemetry.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder +static OpenTelemetry.Trace.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net46/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net46/PublicAPI.Unshipped.txt index f700d27e57c..88e363cc43a 100644 --- a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net46/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net46/PublicAPI.Unshipped.txt @@ -1,5 +1,5 @@ OpenTelemetry.Exporter.InMemoryExporter OpenTelemetry.Exporter.InMemoryExporter.InMemoryExporter(System.Collections.Generic.ICollection exportedItems) -> void -OpenTelemetry.InMemoryExporterHelperExtensions +OpenTelemetry.Trace.InMemoryExporterHelperExtensions override OpenTelemetry.Exporter.InMemoryExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult -static OpenTelemetry.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder +static OpenTelemetry.Trace.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net461/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net461/PublicAPI.Unshipped.txt index d95e3d886ff..f5d39deb7ba 100644 --- a/src/OpenTelemetry.Exporter.InMemory/.publicApi/net461/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.InMemory/.publicApi/net461/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.Extensions.Logging.InMemoryExporterLoggingExtensions +OpenTelemetry.Logs.InMemoryExporterLoggingExtensions OpenTelemetry.Exporter.InMemoryExporter OpenTelemetry.Exporter.InMemoryExporter.InMemoryExporter(System.Collections.Generic.ICollection exportedItems) -> void -OpenTelemetry.InMemoryExporterHelperExtensions +OpenTelemetry.Trace.InMemoryExporterHelperExtensions override OpenTelemetry.Exporter.InMemoryExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult -static Microsoft.Extensions.Logging.InMemoryExporterLoggingExtensions.AddInMemoryExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions -static OpenTelemetry.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder +static OpenTelemetry.Logs.InMemoryExporterLoggingExtensions.AddInMemoryExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions +static OpenTelemetry.Trace.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.InMemory/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.InMemory/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index d95e3d886ff..f5d39deb7ba 100644 --- a/src/OpenTelemetry.Exporter.InMemory/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.InMemory/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.Extensions.Logging.InMemoryExporterLoggingExtensions +OpenTelemetry.Logs.InMemoryExporterLoggingExtensions OpenTelemetry.Exporter.InMemoryExporter OpenTelemetry.Exporter.InMemoryExporter.InMemoryExporter(System.Collections.Generic.ICollection exportedItems) -> void -OpenTelemetry.InMemoryExporterHelperExtensions +OpenTelemetry.Trace.InMemoryExporterHelperExtensions override OpenTelemetry.Exporter.InMemoryExporter.Export(in OpenTelemetry.Batch batch) -> OpenTelemetry.ExportResult -static Microsoft.Extensions.Logging.InMemoryExporterLoggingExtensions.AddInMemoryExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions -static OpenTelemetry.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder +static OpenTelemetry.Logs.InMemoryExporterLoggingExtensions.AddInMemoryExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Logs.OpenTelemetryLoggerOptions +static OpenTelemetry.Trace.InMemoryExporterHelperExtensions.AddInMemoryExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Collections.Generic.ICollection exportedItems) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md b/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md index 74c774cf3e3..944082076a0 100644 --- a/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +* `AddInMemoryExporter` extension method for traces moved from + `OpenTelemetry` namespace to `OpenTelemetry.Trace` namespace. + ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) +* `AddInMemoryExporter` extension method for logs moved from + `Microsoft.Extensions.Logging` namespace to `OpenTelemetry.Logs` namespace. + ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) + ## 1.0.0-rc1.1 Released 2020-Nov-17 diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs index 3666e6efa8e..54addbfc4ee 100644 --- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs @@ -18,9 +18,8 @@ using System.Collections.Generic; using System.Diagnostics; using OpenTelemetry.Exporter; -using OpenTelemetry.Trace; -namespace OpenTelemetry +namespace OpenTelemetry.Trace { public static class InMemoryExporterHelperExtensions { diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs index f191226baf5..62c6e8bd5dd 100644 --- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs @@ -17,11 +17,9 @@ #if NET461 || NETSTANDARD2_0 using System; using System.Collections.Generic; -using OpenTelemetry; using OpenTelemetry.Exporter; -using OpenTelemetry.Logs; -namespace Microsoft.Extensions.Logging +namespace OpenTelemetry.Logs { public static class InMemoryExporterLoggingExtensions { diff --git a/src/OpenTelemetry.Exporter.Prometheus/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Prometheus/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index e490885601f..29aede5f8b3 100644 --- a/src/OpenTelemetry.Exporter.Prometheus/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Prometheus/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -13,9 +13,9 @@ OpenTelemetry.Exporter.Prometheus.PrometheusExporterOptions OpenTelemetry.Exporter.Prometheus.PrometheusExporterOptions.PrometheusExporterOptions() -> void OpenTelemetry.Exporter.Prometheus.PrometheusExporterOptions.Url.get -> string OpenTelemetry.Exporter.Prometheus.PrometheusExporterOptions.Url.set -> void -OpenTelemetry.Exporter.Prometheus.PrometheusRouteBuilderExtensions +Microsoft.AspNetCore.Builder.PrometheusRouteBuilderExtensions override OpenTelemetry.Exporter.Prometheus.PrometheusExporter.ExportAsync(System.Collections.Generic.IEnumerable metrics, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task static OpenTelemetry.Exporter.Prometheus.PrometheusExporterExtensions.GetMetricsCollection(this OpenTelemetry.Exporter.Prometheus.PrometheusExporter exporter) -> string static OpenTelemetry.Exporter.Prometheus.PrometheusExporterExtensions.WriteMetricsCollection(this OpenTelemetry.Exporter.Prometheus.PrometheusExporter exporter, System.IO.StreamWriter writer) -> void -static OpenTelemetry.Exporter.Prometheus.PrometheusRouteBuilderExtensions.UsePrometheus(this Microsoft.AspNetCore.Builder.IApplicationBuilder app) -> Microsoft.AspNetCore.Builder.IApplicationBuilder -virtual OpenTelemetry.Exporter.Prometheus.PrometheusExporterMetricsHttpServer.Dispose(bool disposing) -> void \ No newline at end of file +static Microsoft.AspNetCore.Builder.PrometheusRouteBuilderExtensions.UsePrometheus(this Microsoft.AspNetCore.Builder.IApplicationBuilder app) -> Microsoft.AspNetCore.Builder.IApplicationBuilder +virtual OpenTelemetry.Exporter.Prometheus.PrometheusExporterMetricsHttpServer.Dispose(bool disposing) -> void diff --git a/src/OpenTelemetry.Exporter.Prometheus/CHANGELOG.md b/src/OpenTelemetry.Exporter.Prometheus/CHANGELOG.md index 955df6ef36d..bf642cda59d 100644 --- a/src/OpenTelemetry.Exporter.Prometheus/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Prometheus/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +* `UsePrometheus` extension method for adding middleware to an ASP.NET Core + application moved from `OpenTelemetry.Exporter.Prometheus` namespace to + `Microsoft.AspNetCore.Builder` namespace. + ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) + ## 1.0.0-rc1.1 Released 2020-Nov-17 diff --git a/src/OpenTelemetry.Exporter.Prometheus/PrometheusRouteBuilderExtensions.cs b/src/OpenTelemetry.Exporter.Prometheus/PrometheusRouteBuilderExtensions.cs index 0b38d473419..1d99357d73b 100644 --- a/src/OpenTelemetry.Exporter.Prometheus/PrometheusRouteBuilderExtensions.cs +++ b/src/OpenTelemetry.Exporter.Prometheus/PrometheusRouteBuilderExtensions.cs @@ -16,10 +16,10 @@ #if NETSTANDARD2_0 -using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using OpenTelemetry.Exporter.Prometheus; -namespace OpenTelemetry.Exporter.Prometheus +namespace Microsoft.AspNetCore.Builder { /// /// Provides extension methods for to add Prometheus Scraper Endpoint. diff --git a/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt index 3e2c64e0ee7..8baca87e353 100644 --- a/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt @@ -128,7 +128,7 @@ OpenTelemetry.Resources.Resource.Merge(OpenTelemetry.Resources.Resource other) - OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resource OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder -OpenTelemetry.ResourceBuilderExtensions +OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void @@ -226,11 +226,11 @@ override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.Resource.Empty.get -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateDefault() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateEmpty() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Sdk.CreateMeterProviderBuilder() -> OpenTelemetry.Metrics.MeterProviderBuilder diff --git a/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt index 1e2955cd45a..50b25ab3eb1 100644 --- a/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt @@ -128,7 +128,7 @@ OpenTelemetry.Resources.Resource.Merge(OpenTelemetry.Resources.Resource other) - OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resource OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder -OpenTelemetry.ResourceBuilderExtensions +OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void @@ -226,11 +226,11 @@ override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.Resource.Empty.get -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateDefault() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateEmpty() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Sdk.CreateMeterProviderBuilder() -> OpenTelemetry.Metrics.MeterProviderBuilder diff --git a/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt index 6c2f0a54b5f..35226ea1905 100644 --- a/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt @@ -147,7 +147,7 @@ OpenTelemetry.Resources.Resource.Merge(OpenTelemetry.Resources.Resource other) - OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resource OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder -OpenTelemetry.ResourceBuilderExtensions +OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void @@ -246,11 +246,11 @@ override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder builder, System.Action configure = null) -> Microsoft.Extensions.Logging.ILoggingBuilder static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.Resource.Empty.get -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateDefault() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateEmpty() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Sdk.CreateMeterProviderBuilder() -> OpenTelemetry.Metrics.MeterProviderBuilder diff --git a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 6c2f0a54b5f..35226ea1905 100644 --- a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -147,7 +147,7 @@ OpenTelemetry.Resources.Resource.Merge(OpenTelemetry.Resources.Resource other) - OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resource OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder -OpenTelemetry.ResourceBuilderExtensions +OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void @@ -246,11 +246,11 @@ override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder builder, System.Action configure = null) -> Microsoft.Extensions.Logging.ILoggingBuilder static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddEnvironmentVariableDetector(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.Resource.Empty.get -> OpenTelemetry.Resources.Resource -static OpenTelemetry.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder -static OpenTelemetry.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddAttributes(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, System.Collections.Generic.IEnumerable> attributes) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddService(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder, string serviceName, string serviceNamespace = null, string serviceVersion = null, bool autoGenerateServiceInstanceId = true, string serviceInstanceId = null) -> OpenTelemetry.Resources.ResourceBuilder +static OpenTelemetry.Resources.ResourceBuilderExtensions.AddTelemetrySdk(this OpenTelemetry.Resources.ResourceBuilder resourceBuilder) -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateDefault() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Resources.ResourceBuilder.CreateEmpty() -> OpenTelemetry.Resources.ResourceBuilder static OpenTelemetry.Sdk.CreateMeterProviderBuilder() -> OpenTelemetry.Metrics.MeterProviderBuilder diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index 7eccb2f5f5a..fa8db9e703e 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +* The following extension methods on `ResourceBuilder` has been moved from the + `OpenTelemetry` namespace to the `OpenTelemetry.Resources` namespace: + `AddEnvironmentVariableDetector`, `AddAttributes`, `AddService`, and + `AddTelemetrySdk`. + ([#1576](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1576)) + ## 1.0.0-rc1.1 Released 2020-Nov-17 diff --git a/src/OpenTelemetry/Resources/ResourceBuilderExtensions.cs b/src/OpenTelemetry/Resources/ResourceBuilderExtensions.cs index 9f63cc6a50f..7f8387813ae 100644 --- a/src/OpenTelemetry/Resources/ResourceBuilderExtensions.cs +++ b/src/OpenTelemetry/Resources/ResourceBuilderExtensions.cs @@ -16,9 +16,8 @@ using System; using System.Collections.Generic; -using OpenTelemetry.Resources; -namespace OpenTelemetry +namespace OpenTelemetry.Resources { /// /// Contains extension methods for building s. diff --git a/test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusExporterTests.cs b/test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusExporterTests.cs index 04f2c47be22..f916b3b0ffd 100644 --- a/test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusExporterTests.cs +++ b/test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusExporterTests.cs @@ -20,6 +20,7 @@ using System.Net.Http; using System.Threading.Tasks; #if !NETFRAMEWORK +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection;