.net 启动Hive的OpenTelemtry时出现问题

2w2cym1i  于 2023-01-18  发布在  .NET
关注(0)|答案(1)|浏览(393)

我正试图安装Hive在我的.net示例应用程序与.net 6。
https://docs.honeycomb.io/getting-data-in/opentelemetry/dotnet-distro/#initialize
我在运行代码时遇到错误,出现以下异常:
System.MissingMethodException: 'Method not found: 'OpenTelemetry.Trace.TracerProviderBuilder OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureBuilder(OpenTelemetry.Trace.TracerProviderBuilder, System.Action2<System.IServiceProvider,OpenTelemetry.Trace.TracerProviderBuilder>)'.'`
下面是我的program.cs文件

using Microsoft.EntityFrameworkCore;
using ProductCRUDAPI.Models;
using OpenTelemetry.Trace;
using OpenTelemetry;
using Honeycomb.OpenTelemetry;

var builder = WebApplication.CreateBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("DB");
builder.Services.AddDbContextPool<DbContext>(option => option.UseSqlServer(connectionString));

// Add services to the container.

var honeycombOptions = builder.Configuration.GetHoneycombOptions();

builder.Services.AddControllers();

builder.Services.AddOpenTelemetry().WithTracing(configure: otelBuilder =>
    otelBuilder
        .AddHoneycomb(honeycombOptions)
        .AddAspNetCoreInstrumentationWithBaggage()
).StartWithHost();

builder.Services.AddSingleton(TracerProvider.Default.GetTracer(honeycombOptions.ServiceName));

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();


// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();

}

app.UseAuthorization();

app.MapControllers();

app.Run();

我正在尝试在我的.net示例应用程序中设置honeycomb,以便使用以下指南进行测试
https://docs.honeycomb.io/getting-data-in/opentelemetry/dotnet-distro/#initialize
希望连接能够通过,记录器能够成功初始化,这样我就可以将它附加到我的端点。

hmae6n7t

hmae6n7t1#

我自己刚刚经历过这个错误,有一个包丢失,转到Visual Studio中的NUGet包管理器,选中“包含预发行版”框,然后安装

打开遥测.仪器.AspNetCore

预发布软件包。
Honeycomb最近已经从预发布版升级了他们的OpenTelemetry包,但是似乎一些其他的依赖项需要来自仍然在预发布版中的OpenTelemetry包,像这样的一些问题可能会一直发生,直到所有依赖的包都退出预发布版并且开发稳定一点!

相关问题