I am trying to setup honeycomb in my .net sample app with .net 6.
https://docs.honeycomb.io/getting-data-in/opentelemetry/dotnet-distro/#initialize
I am getting an error when I run my code with the below exception:
System.MissingMethodException: 'Method not found: 'OpenTelemetry.Trace.TracerProviderBuilder OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureBuilder(OpenTelemetry.Trace.TracerProviderBuilder, System.Action`2<System.IServiceProvider,OpenTelemetry.Trace.TracerProviderBuilder>)'.'
Below is my program.cs file
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();
I am trying to setup honeycomb in my .net sample app for testing using the below guide
https://docs.honeycomb.io/getting-data-in/opentelemetry/dotnet-distro/#initialize
Was expecting to get the connection to go through and the logger to initialize successfully so I can attach it to my endpoints.
Just experienced this error myself, there's a package missing, go to the NUGet Package Manager in Visual Studio, checked the "include prerelease" box and then install the
OpenTelemetry.Instrumentation.AspNetCore
prerelease package.
Honeycomb have fairly recently upgraded their OpenTelemetry package from prerelease, but it seems some other dependencies are required from OpenTelemetry packages still in prerelease, some issues like these may keep occurring until all the dependent packages are out of prerelease and development stabilises a bit!