From 73953791688465198e97361f2fb7caa7e3e9e4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 09:01:20 +0100 Subject: [PATCH 1/6] Bump OTel to 1.4.0-rc.1 --- CHANGELOG.md | 9 +++ docs/README.md | 2 +- docs/config.md | 8 +-- docs/plugins.md | 34 +++++------ .../OpenTelemetry.AutoInstrumentation.nuspec | 60 +++++++++---------- .../OpenTelemetry.AutoInstrumentation.csproj | 32 +++++----- .../TestApplication.Plugins.csproj | 6 +- 7 files changed, 80 insertions(+), 71 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fae1f9bb47..2c102b8dc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h ## [Unreleased](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/compare/v0.5.1-beta.2...HEAD) +This beta release is built on top of [OpenTelemetry .NET](https://github.com/open-telemetry/opentelemetry-dotnet): + +- [Core components](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/VERSIONING.md#core-components): + [`1.4.0-rc.1`](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.4.0-rc.1) +- `System.Diagnostics.DiagnosticSource`: [`7.0.0`](https://www.nuget.org/packages/System.Diagnostics.DiagnosticSource/7.0.0) + ### Added - Add plugin support for @@ -14,6 +20,9 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h ### Changed +- Updated [Core components](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/VERSIONING.md#core-components): + [`1.4.0-rc.1`](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.4.0-rc.1) + ### Deprecated ### Removed diff --git a/docs/README.md b/docs/README.md index d8e97b078d..2792f783ce 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,7 +18,7 @@ OpenTelemetry .NET Automatic Instrumentation is built on top of [OpenTelemetry .NET](https://github.com/open-telemetry/opentelemetry-dotnet): - [Core components](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/VERSIONING.md#core-components): -[`1.4.0-beta.3`](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.4.0-beta.3) +[`1.4.0-rc.1`](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.4.0-rc.1) - `System.Diagnostics.DiagnosticSource`: [`7.0.0`](https://www.nuget.org/packages/System.Diagnostics.DiagnosticSource/7.0.0) referencing `System.Runtime.CompilerServices.Unsafe`: [`6.0.0`](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/6.0.0) diff --git a/docs/config.md b/docs/config.md index 4c8945f1be..34c6098dca 100644 --- a/docs/config.md +++ b/docs/config.md @@ -158,7 +158,7 @@ To enable the OTLP exporter, set the `OTEL_TRACES_EXPORTER`/`OTEL_METRICS_EXPORT environment variable to `otlp`. To customize the OTLP exporter using environment variables, see the -[OTLP exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-beta.3/src/OpenTelemetry.Exporter.OpenTelemetryProtocol#environment-variables). +[OTLP exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-rc.1/src/OpenTelemetry.Exporter.OpenTelemetryProtocol#environment-variables). Important environment variables include: | Environment variable | Description | Default value | @@ -192,7 +192,7 @@ To enable the Jaeger exporter, set the `OTEL_TRACES_EXPORTER` environment variab to `jaeger`. To customize the Jaeger exporter using environment variables, see the -[Jaeger exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-beta.3/src/OpenTelemetry.Exporter.Jaeger#environment-variables). +[Jaeger exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-rc.1/src/OpenTelemetry.Exporter.Jaeger#environment-variables). Important environment variables include: | Environment variable | Description | Default value | @@ -219,7 +219,7 @@ The exporter exposes the metrics HTTP endpoint on `http://localhost:9464/metrics and it caches the responses for 300 milliseconds. See the -[Prometheus Exporter HttpListener documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-beta.3/src/OpenTelemetry.Exporter.Prometheus.HttpListener). +[Prometheus Exporter HttpListener documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-rc.1/src/OpenTelemetry.Exporter.Prometheus.HttpListener). to learn more. ### Zipkin @@ -228,7 +228,7 @@ To enable the Zipkin exporter, set the `OTEL_TRACES_EXPORTER` environment variable to `zipkin`. To customize the Zipkin exporter using environment variables, -see the [Zipkin exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-beta.3/src/OpenTelemetry.Exporter.Zipkin#configuration-using-environment-variables). +see the [Zipkin exporter documentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/core-1.4.0-rc.1/src/OpenTelemetry.Exporter.Zipkin#configuration-using-environment-variables). Important environment variables include: | Environment variable | Description | Default value | diff --git a/docs/plugins.md b/docs/plugins.md index 812f883c92..1aac2c0080 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -67,15 +67,15 @@ public class MyPlugin | Options type | NuGet package | NuGet version | |------------------------------------------------------------------------------------------------|---------------------------------------------------|---------------| -| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.ZipkinExporterOptions | OpenTelemetry.Exporter.Zipkin | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.JaegerExporterOptions | OpenTelemetry.Exporter.Jaeger | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-beta.3 | +| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.ZipkinExporterOptions | OpenTelemetry.Exporter.Zipkin | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.JaegerExporterOptions | OpenTelemetry.Exporter.Jaeger | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-rc.1 | | OpenTelemetry.Instrumentation.AspNet.AspNetInstrumentationOptions | OpenTelemetry.Instrumentation.AspNet | 1.0.0-rc9.7 | -| OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions | OpenTelemetry.Instrumentation.AspNetCore | 1.0.0-rc9.9 | -| OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions | OpenTelemetry.Instrumentation.GrpcNetClient | 1.0.0-rc9.9 | -| OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions | OpenTelemetry.Instrumentation.Http | 1.0.0-rc9.9 | -| OpenTelemetry.Instrumentation.SqlClient.SqlClientInstrumentationOptions | OpenTelemetry.Instrumentation.SqlClient | 1.0.0-rc9.9 | +| OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions | OpenTelemetry.Instrumentation.AspNetCore | 1.0.0-rc9.10 | +| OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions | OpenTelemetry.Instrumentation.GrpcNetClient | 1.0.0-rc9.10 | +| OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions | OpenTelemetry.Instrumentation.Http | 1.0.0-rc9.10 | +| OpenTelemetry.Instrumentation.SqlClient.SqlClientInstrumentationOptions | OpenTelemetry.Instrumentation.SqlClient | 1.0.0-rc9.10 | | OpenTelemetry.Instrumentation.StackExchangeRedis.StackExchangeRedisCallsInstrumentationOptions | OpenTelemetry.Instrumentation.StackExchangeRedis" | 1.0.0-rc9.7 | | OpenTelemetry.Instrumentation.MySqlData.MySqlDataInstrumentationOptions | OpenTelemetry.Instrumentation.MySqlData | 1.0.0-beta.4 | | OpenTelemetry.Instrumentation.Wcf.WcfInstrumentationOptions | OpenTelemetry.Instrumentation.Wcf | 1.0.0-rc7 | @@ -84,20 +84,20 @@ public class MyPlugin | Options type | NuGet package | NuGet version | |---------------------------------------------------------------------|------------------------------------------------|---------------| -| OpenTelemetry.Metrics.MetricReaderOptions | OpenTelemetry | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.PrometheusExporterOptions | OpenTelemetry.Exporter.Prometheus.HttpListener | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-beta.3 | -| OpenTelemetry.Instrumentation.Runtime.RuntimeInstrumentationOptions | OpenTelemetry.Instrumentation.Runtime | 1.1.0-beta.1 | -| OpenTelemetry.Instrumentation.Process.ProcessInstrumentationOptions | OpenTelemetry.Instrumentation.Process | 1.0.0-alpha.2 | +| OpenTelemetry.Metrics.MetricReaderOptions | OpenTelemetry | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.PrometheusExporterOptions | OpenTelemetry.Exporter.Prometheus.HttpListener | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-rc.1 | +| OpenTelemetry.Instrumentation.Runtime.RuntimeInstrumentationOptions | OpenTelemetry.Instrumentation.Runtime | 1.1.0-beta.2 | +| OpenTelemetry.Instrumentation.Process.ProcessInstrumentationOptions | OpenTelemetry.Instrumentation.Process | 1.0.0-alpha.3 | ### Logs | Options type | NuGet package | NuGet version | |-----------------------------------------------|----------------------------------------------|---------------| -| OpenTelemetry.Logs.OpenTelemetryLoggerOptions | OpenTelemetry | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-beta.3 | -| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-beta.3 | +| OpenTelemetry.Logs.OpenTelemetryLoggerOptions | OpenTelemetry | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-rc.1 | ## Requirements diff --git a/nuget/OpenTelemetry.AutoInstrumentation.nuspec b/nuget/OpenTelemetry.AutoInstrumentation.nuspec index c05516b90b..2919ca5534 100644 --- a/nuget/OpenTelemetry.AutoInstrumentation.nuspec +++ b/nuget/OpenTelemetry.AutoInstrumentation.nuspec @@ -13,40 +13,40 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - + diff --git a/src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj b/src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj index 36c890d952..bb99335e82 100644 --- a/src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj +++ b/src/OpenTelemetry.AutoInstrumentation/OpenTelemetry.AutoInstrumentation.csproj @@ -8,21 +8,21 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + @@ -33,10 +33,10 @@ - + - + diff --git a/test/test-applications/integrations/TestApplication.Plugins/TestApplication.Plugins.csproj b/test/test-applications/integrations/TestApplication.Plugins/TestApplication.Plugins.csproj index f23fd4b9bf..9f2a8b69c2 100644 --- a/test/test-applications/integrations/TestApplication.Plugins/TestApplication.Plugins.csproj +++ b/test/test-applications/integrations/TestApplication.Plugins/TestApplication.Plugins.csproj @@ -4,9 +4,9 @@ - - - + + + From 62e666b1141ed4eb90758446b31938581b8ce2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 09:04:19 +0100 Subject: [PATCH 2/6] ConfigureResource api was removed in https://github.com/open-telemetry/opentelemetry-dotnet/pull/3999 --- .../Configuration/ResourceConfigurator.cs | 7 +++++++ .../Logger/LogBuilderExtensions.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.AutoInstrumentation/Configuration/ResourceConfigurator.cs b/src/OpenTelemetry.AutoInstrumentation/Configuration/ResourceConfigurator.cs index 3884be6b8e..608d3f756d 100644 --- a/src/OpenTelemetry.AutoInstrumentation/Configuration/ResourceConfigurator.cs +++ b/src/OpenTelemetry.AutoInstrumentation/Configuration/ResourceConfigurator.cs @@ -27,4 +27,11 @@ public static void Configure(ResourceBuilder resourceBuilder) .AddTelemetrySdk() .AddAttributes(new KeyValuePair[] { new(Constants.Tracer.AutoInstrumentationVersionName, Constants.Tracer.Version) }); } + + public static ResourceBuilder CreateResourceBuilder() + { + var resourceBuilder = ResourceBuilder.CreateDefault(); + Configure(resourceBuilder); + return resourceBuilder; + } } diff --git a/src/OpenTelemetry.AutoInstrumentation/Logger/LogBuilderExtensions.cs b/src/OpenTelemetry.AutoInstrumentation/Logger/LogBuilderExtensions.cs index 98367ea202..8ab3318985 100644 --- a/src/OpenTelemetry.AutoInstrumentation/Logger/LogBuilderExtensions.cs +++ b/src/OpenTelemetry.AutoInstrumentation/Logger/LogBuilderExtensions.cs @@ -48,7 +48,7 @@ public static ILoggingBuilder AddOpenTelemetryLogs(this ILoggingBuilder builder) builder.AddOpenTelemetry(options => { - options.ConfigureResource(ResourceConfigurator.Configure); + options.SetResourceBuilder(ResourceConfigurator.CreateResourceBuilder()); options.IncludeFormattedMessage = settings.IncludeFormattedMessage; From 11113c67cf516e3edc36b9950c9a7dc6ad3489b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 09:09:55 +0100 Subject: [PATCH 3/6] Update limits based on https://github.com/open-telemetry/opentelemetry-dotnet/pull/3978 --- docs/config.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/config.md b/docs/config.md index 34c6098dca..93d964ea5d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -168,13 +168,13 @@ Important environment variables include: | `OTEL_EXPORTER_OTLP_TIMEOUT` | The max waiting time (in milliseconds) for the backend to process each batch. | `10000` | | `OTEL_EXPORTER_OTLP_HEADERS` | Comma-separated list of additional HTTP headers sent with each export, for example: `Authorization=secret,X-Key=Value`. | | | `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` | Maximum allowed attribute value size. | none | -| `OTEL_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed span attribute count. | none | +| `OTEL_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed span attribute count. | 128 | | `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` | Maximum allowed attribute value size. [Not applicable for metrics.](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.15.0/specification/metrics/sdk.md#attribute-limits). | none | -| `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed span attribute count. [Not applicable for metrics.](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.15.0/specification/metrics/sdk.md#attribute-limits). | none | -| `OTEL_SPAN_EVENT_COUNT_LIMIT` | Maximum allowed span event count. | none | -| `OTEL_SPAN_LINK_COUNT_LIMIT` | Maximum allowed span link count. | none | -| `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed attribute per span event count. | none | -| `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed attribute per span link count. | none | +| `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed span attribute count. [Not applicable for metrics.](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.15.0/specification/metrics/sdk.md#attribute-limits). | 128 | +| `OTEL_SPAN_EVENT_COUNT_LIMIT` | Maximum allowed span event count. | 128 | +| `OTEL_SPAN_LINK_COUNT_LIMIT` | Maximum allowed span link count. | 128 | +| `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed attribute per span event count. | 128 | +| `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` | Maximum allowed attribute per span link count. | 128 | **[1]**: Considerations on the `OTEL_EXPORTER_OTLP_PROTOCOL`: From 94ef22516a519384d9b85820f57cbb415bf75d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 09:53:50 +0100 Subject: [PATCH 4/6] Fix build structure OpenTelemetry references OpenTelemetry.Extensions.DependencyInjection package --- .../BuildTests.DistributionStructure_alpine-linux.verified.txt | 1 + .../BuildTests.DistributionStructure_linux.verified.txt | 1 + .../BuildTests.DistributionStructure_osx.verified.txt | 1 + .../BuildTests.DistributionStructure_windows.verified.txt | 2 ++ 4 files changed, 5 insertions(+) diff --git a/test/IntegrationTests/BuildTests.DistributionStructure_alpine-linux.verified.txt b/test/IntegrationTests/BuildTests.DistributionStructure_alpine-linux.verified.txt index ab4cdeb021..12b47c187c 100644 --- a/test/IntegrationTests/BuildTests.DistributionStructure_alpine-linux.verified.txt +++ b/test/IntegrationTests/BuildTests.DistributionStructure_alpine-linux.verified.txt @@ -33,6 +33,7 @@ /net/OpenTelemetry.Exporter.OpenTelemetryProtocol.dll, /net/OpenTelemetry.Exporter.Prometheus.HttpListener.dll, /net/OpenTelemetry.Exporter.Zipkin.dll, + /net/OpenTelemetry.Extensions.DependencyInjection.dll, /net/OpenTelemetry.Extensions.Propagators.dll, /net/OpenTelemetry.Instrumentation.AspNetCore.dll, /net/OpenTelemetry.Instrumentation.GrpcNetClient.dll, diff --git a/test/IntegrationTests/BuildTests.DistributionStructure_linux.verified.txt b/test/IntegrationTests/BuildTests.DistributionStructure_linux.verified.txt index ab4cdeb021..12b47c187c 100644 --- a/test/IntegrationTests/BuildTests.DistributionStructure_linux.verified.txt +++ b/test/IntegrationTests/BuildTests.DistributionStructure_linux.verified.txt @@ -33,6 +33,7 @@ /net/OpenTelemetry.Exporter.OpenTelemetryProtocol.dll, /net/OpenTelemetry.Exporter.Prometheus.HttpListener.dll, /net/OpenTelemetry.Exporter.Zipkin.dll, + /net/OpenTelemetry.Extensions.DependencyInjection.dll, /net/OpenTelemetry.Extensions.Propagators.dll, /net/OpenTelemetry.Instrumentation.AspNetCore.dll, /net/OpenTelemetry.Instrumentation.GrpcNetClient.dll, diff --git a/test/IntegrationTests/BuildTests.DistributionStructure_osx.verified.txt b/test/IntegrationTests/BuildTests.DistributionStructure_osx.verified.txt index 624bce6524..69b74445d5 100644 --- a/test/IntegrationTests/BuildTests.DistributionStructure_osx.verified.txt +++ b/test/IntegrationTests/BuildTests.DistributionStructure_osx.verified.txt @@ -33,6 +33,7 @@ /net/OpenTelemetry.Exporter.OpenTelemetryProtocol.dll, /net/OpenTelemetry.Exporter.Prometheus.HttpListener.dll, /net/OpenTelemetry.Exporter.Zipkin.dll, + /net/OpenTelemetry.Extensions.DependencyInjection.dll, /net/OpenTelemetry.Extensions.Propagators.dll, /net/OpenTelemetry.Instrumentation.AspNetCore.dll, /net/OpenTelemetry.Instrumentation.GrpcNetClient.dll, diff --git a/test/IntegrationTests/BuildTests.DistributionStructure_windows.verified.txt b/test/IntegrationTests/BuildTests.DistributionStructure_windows.verified.txt index c614c977b4..83e27fa086 100644 --- a/test/IntegrationTests/BuildTests.DistributionStructure_windows.verified.txt +++ b/test/IntegrationTests/BuildTests.DistributionStructure_windows.verified.txt @@ -32,6 +32,7 @@ \net\OpenTelemetry.Exporter.OpenTelemetryProtocol.dll, \net\OpenTelemetry.Exporter.Prometheus.HttpListener.dll, \net\OpenTelemetry.Exporter.Zipkin.dll, + \net\OpenTelemetry.Extensions.DependencyInjection.dll, \net\OpenTelemetry.Extensions.Propagators.dll, \net\OpenTelemetry.Instrumentation.AspNetCore.dll, \net\OpenTelemetry.Instrumentation.GrpcNetClient.dll, @@ -87,6 +88,7 @@ \netfx\OpenTelemetry.Exporter.OpenTelemetryProtocol.dll, \netfx\OpenTelemetry.Exporter.Prometheus.HttpListener.dll, \netfx\OpenTelemetry.Exporter.Zipkin.dll, + \netfx\OpenTelemetry.Extensions.DependencyInjection.dll, \netfx\OpenTelemetry.Extensions.Propagators.dll, \netfx\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.dll, \netfx\OpenTelemetry.Instrumentation.AspNet.dll, From f2b5325786d6a76eb67e31639f3038af38f582fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 09:59:37 +0100 Subject: [PATCH 5/6] Fix ModuleTests --- test/IntegrationTests/ModuleTests.Default.NetCore.verified.txt | 1 + test/IntegrationTests/ModuleTests.Default.NetFx.verified.txt | 1 + .../ModuleTests.DefaultNoExporters.NetCore.verified.txt | 1 + .../ModuleTests.DefaultNoExporters.NetFx.verified.txt | 1 + test/IntegrationTests/ModuleTests.Minimal.NetCore.verified.txt | 3 ++- test/IntegrationTests/ModuleTests.Minimal.NetFx.verified.txt | 3 ++- 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/IntegrationTests/ModuleTests.Default.NetCore.verified.txt b/test/IntegrationTests/ModuleTests.Default.NetCore.verified.txt index a676acbda7..cb876d473a 100644 --- a/test/IntegrationTests/ModuleTests.Default.NetCore.verified.txt +++ b/test/IntegrationTests/ModuleTests.Default.NetCore.verified.txt @@ -5,6 +5,7 @@ OpenTelemetry.AutoInstrumentation.Loader, OpenTelemetry.AutoInstrumentation.StartupHook, OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection, OpenTelemetry.Instrumentation.Http, OpenTelemetry.Instrumentation.Process, OpenTelemetry.Instrumentation.Runtime diff --git a/test/IntegrationTests/ModuleTests.Default.NetFx.verified.txt b/test/IntegrationTests/ModuleTests.Default.NetFx.verified.txt index 5253db0a00..badf5e2d3b 100644 --- a/test/IntegrationTests/ModuleTests.Default.NetFx.verified.txt +++ b/test/IntegrationTests/ModuleTests.Default.NetFx.verified.txt @@ -4,6 +4,7 @@ OpenTelemetry.AutoInstrumentation, OpenTelemetry.AutoInstrumentation.Loader, OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection, OpenTelemetry.Instrumentation.Http, OpenTelemetry.Instrumentation.Process, OpenTelemetry.Instrumentation.Runtime diff --git a/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetCore.verified.txt b/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetCore.verified.txt index 9659dc62a4..7c9b62a6a1 100644 --- a/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetCore.verified.txt +++ b/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetCore.verified.txt @@ -5,6 +5,7 @@ OpenTelemetry.AutoInstrumentation.Loader, OpenTelemetry.AutoInstrumentation.StartupHook, OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection, OpenTelemetry.Instrumentation.Process, OpenTelemetry.Instrumentation.Runtime ] \ No newline at end of file diff --git a/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetFx.verified.txt b/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetFx.verified.txt index c92e7b38d5..e957461743 100644 --- a/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetFx.verified.txt +++ b/test/IntegrationTests/ModuleTests.DefaultNoExporters.NetFx.verified.txt @@ -4,6 +4,7 @@ OpenTelemetry.AutoInstrumentation, OpenTelemetry.AutoInstrumentation.Loader, OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection, OpenTelemetry.Instrumentation.Process, OpenTelemetry.Instrumentation.Runtime ] \ No newline at end of file diff --git a/test/IntegrationTests/ModuleTests.Minimal.NetCore.verified.txt b/test/IntegrationTests/ModuleTests.Minimal.NetCore.verified.txt index bc7e44b9d4..518ebb55eb 100644 --- a/test/IntegrationTests/ModuleTests.Minimal.NetCore.verified.txt +++ b/test/IntegrationTests/ModuleTests.Minimal.NetCore.verified.txt @@ -4,5 +4,6 @@ OpenTelemetry.AutoInstrumentation, OpenTelemetry.AutoInstrumentation.Loader, OpenTelemetry.AutoInstrumentation.StartupHook, - OpenTelemetry.Exporter.OpenTelemetryProtocol + OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection ] \ No newline at end of file diff --git a/test/IntegrationTests/ModuleTests.Minimal.NetFx.verified.txt b/test/IntegrationTests/ModuleTests.Minimal.NetFx.verified.txt index f114faaf17..84cbe3ca55 100644 --- a/test/IntegrationTests/ModuleTests.Minimal.NetFx.verified.txt +++ b/test/IntegrationTests/ModuleTests.Minimal.NetFx.verified.txt @@ -3,5 +3,6 @@ OpenTelemetry.Api, OpenTelemetry.AutoInstrumentation, OpenTelemetry.AutoInstrumentation.Loader, - OpenTelemetry.Exporter.OpenTelemetryProtocol + OpenTelemetry.Exporter.OpenTelemetryProtocol, + OpenTelemetry.Extensions.DependencyInjection ] \ No newline at end of file From b8f8a8a976c749adc07d83b045f211c14aca24e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 13 Dec 2022 10:55:16 +0100 Subject: [PATCH 6/6] Handle AspNetCore metrics changes --- CHANGELOG.md | 2 ++ docs/plugins.md | 17 +++++++++-------- .../AspNetCoreMetricsInitializer.cs | 10 +++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c102b8dc6..878f4b5779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ This beta release is built on top of [OpenTelemetry .NET](https://github.com/ope - Add plugin support for `ConfigureTracesOptions(StackExchangeRedisCallsInstrumentationOptions options)`. +- Add plugin support for + `ConfigureMetricsOptions(AspNetCoreMetricsInstrumentationOptions options)`. ### Changed diff --git a/docs/plugins.md b/docs/plugins.md index 1aac2c0080..b5e2851abd 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -82,14 +82,15 @@ public class MyPlugin ### Metrics -| Options type | NuGet package | NuGet version | -|---------------------------------------------------------------------|------------------------------------------------|---------------| -| OpenTelemetry.Metrics.MetricReaderOptions | OpenTelemetry | 1.4.0-rc.1 | -| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-rc.1 | -| OpenTelemetry.Exporter.PrometheusExporterOptions | OpenTelemetry.Exporter.Prometheus.HttpListener | 1.4.0-rc.1 | -| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-rc.1 | -| OpenTelemetry.Instrumentation.Runtime.RuntimeInstrumentationOptions | OpenTelemetry.Instrumentation.Runtime | 1.1.0-beta.2 | -| OpenTelemetry.Instrumentation.Process.ProcessInstrumentationOptions | OpenTelemetry.Instrumentation.Process | 1.0.0-alpha.3 | +| Options type | NuGet package | NuGet version | +|----------------------------------------------------------------------------------|------------------------------------------------|---------------| +| OpenTelemetry.Metrics.MetricReaderOptions | OpenTelemetry | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.ConsoleExporterOptions | OpenTelemetry.Exporter.Console | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.PrometheusExporterOptions | OpenTelemetry.Exporter.Prometheus.HttpListener | 1.4.0-rc.1 | +| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.4.0-rc.1 | +| OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreMetricsInstrumentationOptions | OpenTelemetry.Instrumentation.Process | 1.0.0-rc9.10 | +| OpenTelemetry.Instrumentation.Runtime.RuntimeInstrumentationOptions | OpenTelemetry.Instrumentation.Runtime | 1.1.0-beta.2 | +| OpenTelemetry.Instrumentation.Process.ProcessInstrumentationOptions | OpenTelemetry.Instrumentation.Process | 1.0.0-alpha.3 | ### Logs diff --git a/src/OpenTelemetry.AutoInstrumentation/Loading/Initializers/AspNetCoreMetricsInitializer.cs b/src/OpenTelemetry.AutoInstrumentation/Loading/Initializers/AspNetCoreMetricsInitializer.cs index 68653fd888..be9db9ccd5 100644 --- a/src/OpenTelemetry.AutoInstrumentation/Loading/Initializers/AspNetCoreMetricsInitializer.cs +++ b/src/OpenTelemetry.AutoInstrumentation/Loading/Initializers/AspNetCoreMetricsInitializer.cs @@ -17,6 +17,8 @@ #if NET6_0_OR_GREATER using System; +using System.Reflection; +using OpenTelemetry.Instrumentation.AspNetCore; namespace OpenTelemetry.AutoInstrumentation.Loading.Initializers; @@ -29,9 +31,15 @@ public AspNetCoreMetricsInitializer() public override void Initialize(ILifespanManager lifespanManager) { + var optionsType = Type.GetType("OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreMetricsInstrumentationOptions, OpenTelemetry.Instrumentation.AspNetCore"); var metricsType = Type.GetType("OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreMetrics, OpenTelemetry.Instrumentation.AspNetCore"); - var aspNetCoreMetrics = Activator.CreateInstance(metricsType); + var aspNetCoreMetricsInstrumentationOptions = new AspNetCoreMetricsInstrumentationOptions(); + + Instrumentation.PluginManager.ConfigureMetricsOptions(aspNetCoreMetricsInstrumentationOptions); + + var constructor = metricsType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, new[] { typeof(AspNetCoreMetricsInstrumentationOptions) }); + var aspNetCoreMetrics = constructor.Invoke(new[] { aspNetCoreMetricsInstrumentationOptions }); lifespanManager.Track(aspNetCoreMetrics); }