程序包引用
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.4.0-beta.2" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus" Version="1.2.0-rc5"/>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.8" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.8" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.8" />
程序.cs
builder.Services.AddOpenTelemetryMetrics(b =>
{
b.AddPrometheusExporter();
b.AddMeter(TelemetryConstants.MyAppSource);
b.SetResourceBuilder(resource);
b.AddHttpClientInstrumentation();
b.AddAspNetCoreInstrumentation();
});
当我运行应用程序时,它给出以下错误System.TypeLoadException: 'Could not load type 'System.ServiceProviderExtensions' from assembly 'OpenTelemetry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7bd6737fe5b67e3c'.'
位于app.UseOpenTelemetryPrometheusScrapingEndpoint();
2条答案
按热度按时间gtlvzcf81#
尝试将OpenTelemetry.Exporter.Prometheus的版本切换回1. 4. 0-alpha.2至少它解决了我的问题。
omqzjyyz2#
添加
opentelemetry.exporter.prometheus.aspnetcore
软件包后,错误消失。