opentelemetry-dotnet: Regression: Upgrading from OTel Exporters 1.0.0-rc9.4 to 1.0.0-rc9.5 and 1.0.0-rc9.6 results in `MethodAccessException`
Bug Report
@dependabot made the following upgrades to packages (all synced from a common Directory.Build.props
variable) :
- Bumps
OTelExporterVersion
from 1.0.0-rc9.4 to 1.0.0-rc9.5. - Updates OpenTelemetry.Extensions.Hosting from 1.0.0-rc9.4 to 1.0.0-rc9.5
- Updates OpenTelemetry.Instrumentation.AspNetCore from 1.0.0-rc9.4 to 1.0.0-rc9.5
- Updates OpenTelemetry.Instrumentation.Http from 1.0.0-rc9.4 to 1.0.0-rc9.5
- Updates OpenTelemetry.Instrumentation.SqlClient from 1.0.0-rc9.4 to 1.0.0-rc9.5
We’re also using:
OpenTelemetry.Exporter.Jaeger 1.3.0 OpenTelemetry.Exporter.Prometheus 1.2.0-rc5
Runtime version: .NET Core & ASP.NET Core 3.1 / .NET & ASP.NET Core 6 .0
Symptom
.Configure(app =>
{
app.UseRouting();
app.UseOpenTelemetryPrometheusScrapingEndpoint(); // now throws a MethodAccessException under 1.0.0-rc9.5
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context => await context.Response.WriteAsync("hi!"));
endpoints.MapControllers();
});
})
Throws the following error:
MethodAccessException: Attempt by method 'Microsoft.AspNetCore.Builder.PrometheusExporterApplicationBuilderExtensions.UseOpenTelemetryPrometheusScrapingEndpoint(Microsoft.AspNetCore.Builder.IApplicationBuilder, OpenTelemetry.Metrics.MeterProvider)' to access method 'System.ServiceProviderExtensions.GetOptions<OpenTelemetry.Exporter.PrometheusExporterOptions>(System.IServiceProvider)' failed.
Rolling those other packages back to 1.0.0-rc9.4 fixes the issue.
What is the expected behavior?
The Prometheus metrics endpoint should start up without issue and /metrics
served correctly.
What is the actual behavior?
A crash that causes the ASP.NET process to exit.
Reproduce
https://github.com/Aaronontheweb/OTelAspNetReproduction/blob/master/OTelRepro/Program.cs <-- running this bare minimum dotnet new webapp
ASP.NET 6.0 sample will reproduce the error.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 15 (8 by maintainers)
Prometheus Exporter package has been split into two:
It will work fine if you use the AspNetCore package.
The error is due to the fact that Prometheus exporter packages rely on access to some
internal
methods of the OTel SDK. Starting1.4.0-alpha.1
version of the OTel SDK, those internal methods are not exposed to the old “single” Prometheus exporter package.Just tried with 1.0.0-rc9.6 - still fails.
@utpilla Can you take a look?
I really dont’ know how to construct an example. My theory is here:
MyApp actually compiles with latest OTel rc, but exits at start with this output:
UPDATE, noticed
7.0.0.0
instead of7.0.0-rc.1.22426.10
could be caused by jfrog?