Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown when newer OpenTelemetry packages are used #91

Open
pyohannes opened this issue Apr 23, 2024 · 0 comments
Open

Exception is thrown when newer OpenTelemetry packages are used #91

pyohannes opened this issue Apr 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pyohannes
Copy link
Contributor

Bug Report

  • Grafana.OpenTelemetry 0.7.0-beta.4
  • .NET 7

Symptom

During intializing a tracer or meter provider, the application aborts with the following error:

Unhandled exception. System.TypeLoadException: Could not load type 'OpenTelemetry.Internal.ConfigurationExtensions' from assembly 'OpenTelemetry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7bd6737fe5b67e3c'.

Reproduce

One can use this project file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Grafana.OpenTelemetry" Version="0.7.0-beta.4" />
    <PackageReference Include="OpenTelemetry" Version="1.8.1" />
    <PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.8.1" />
    <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
    <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
    <PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
  </ItemGroup>

</Project>

And this application:

using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using Grafana.OpenTelemetry;

public class Program
{
    public static void Main(string[] args)
    {
        using var tracerProvider = Sdk.CreateTracerProviderBuilder()
            .UseGrafana()
            .Build();
        using var meterProvider = Sdk.CreateMeterProviderBuilder()
            .UseGrafana()
            .Build();
    }
} 

Additional Context

Removing any OpenTelemetry packages from the project file resolves the issue.

@pyohannes pyohannes added the bug Something isn't working label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant