open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.2k stars 758 forks source link

[Error] While setting up dev env #5890

Open Annosha opened 6 days ago

Annosha commented 6 days ago

Package

OpenTelemetry

Package Version

$(TargetFrameworksForLibrariesExtended) OpenTelemetry .NET SDK core-

Runtime Version

Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Description

I was setting up dev env on my local machine and followed the instructions in CONTRIBUTING.md. After cloning and running dotnet test on top level. I get following errors.

Note: I've changed touched the code yet. err3 errorTestRUN1 errorTestRUN2 TestRunReport

What am I missing?

Steps to Reproduce

Followed instructions here I forked and cloned the repo with required version of sdk "version": "9.0.100-rc.1.24452.12" and ran:dotnet test

Expected Result

Since I haven't made changes in the code the tests must pass without errors.

Actual Result

TestRunReport

Additional Context

No response

TimothyMothra commented 5 days ago

Looking at the screenshots, it looks like you might have multiple issues. I would recommend on focusing on running the tests in one project at a time so you can focus on specific issues.

I see one exception in your screenshot:

PrometheusCollectionManagerTests.EnterExitCollectTest ErrorMessage: System.InvalidOperationException: PrometheusExporter HttpListener could not be started. HttpListenerException: Failed to listen on prefix 'http://localhost:9464/metrics/' because it conflicts with an existing registration on the machine.

You would have to review if that endpoint is already in use on your machine. I've seen that when unit tests crash, test servers don't get cleaned up. If that's the case, the easiest thing would be to restart your dev machine to force close all processes. And then focus on running the tests in one project at a time.

TimothyMothra commented 3 days ago

It looks like you're working with multiple repos at once. I see in your error message: "OpenTelemetry.Instrumentation.Http". That's not THIS repo.

Let me stress that you should focus on one repo at a time until you can resolve all the issues.

Try this:

  1. create a new directory
  2. open a command line terminal and navigate to the new directory.
  3. clone only this repo via command line: git clone https://github.com/open-telemetry/opentelemetry-dotnet.git
  4. try to compile this repo: dotnet build .\opentelemetry-dotnet\OpenTelemetry.sln

This will either pass or fail. If this fails you should have a distinct list of issues to investigate.

Annosha commented 1 day ago

@TimothyMothra sorry about the confusion in above comment. The earlier issue still persists. I've checked the end points and they aren't in use on my system. I have also cloned a fresh repo to get a clean start. (Deleted all files from the system for prev one).

Note: Before installing the required version of .NET SDK which is 9.0.100-rc.1.24452.12 I installed a .NET SDK 8.0.403. But since the required version was .NET SDK 9.0.100-rc.1.24452.12 so I deleted the old one from system.

Now the dotnet test is still giving same errors. I'm going to copy some of the failed test logs:

Please check the diagnostic logs for more information. OpenTelemetry.Tests test net8.0 failed with 1 error(s) (2.0s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Tests\bin\Debug\net8.0\OpenTelemetry.Tests.dll : error TESTRUNABORT: Test Run Aborted. You must install or update .NET to run this application. App: C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Exporter.Zipkin.Tests\bin\Debug\net8.0\testhost.exe Architecture: x64 Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64) .NET location: C:\Program Files\dotnet The following frameworks were found: 9.0.0-rc.1.24431.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

. Please check the diagnostic logs for more information. OpenTelemetry.Exporter.Zipkin.Tests test net8.0 failed with 1 error(s) (2.2s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Exporter.Zipkin.Tests\bin\Debug\net8.0\OpenTelemetry.Exporter.Zipkin.Tests.dll : error TESTRUNABORT: Test Run Aborted.

. Please check the diagnostic logs for more information. OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests test net8.0 failed with 1 error(s) (0.9s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\bin\Debug\net8.0\OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.dll : error TESTRUNABORT: Test Run Aborted.

. Please check the diagnostic logs for more information. OpenTelemetry.Extensions.Hosting.Tests test net8.0 failed with 1 error(s) (0.8s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Extensions.Hosting.Tests\bin\Debug\net8.0\OpenTelemetry.Extensions.Hosting.Tests.dll : error TESTRUNABORT: Test Run Aborted.

[xUnit.net 00:00:09.42] Finished: OpenTelemetry.Exporter.Prometheus.HttpListener.Tests OpenTelemetry.Exporter.Prometheus.HttpListener.Tests test net462 failed with 3 error(s) (11.6s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\src\OpenTelemetry.Exporter.Prometheus.HttpListener\PrometheusHttpListenerMeterProviderBuilderExtensions.cs(95): error TESTERROR: OpenTelemetry.Exporter.Prometheus.Tests.PrometheusCollectionManagerTests.EnterExitCollectTest(scrapeResponseCacheD urationMilliseconds: 0, openMetricsRequested: True) (7ms): Error Message: System.InvalidOperationException : Prome theusExporter HttpListener could not be started.

. Please check the diagnostic logs for more information. OpenTelemetry.Api.Tests test net8.0 failed with 1 error(s) (0.6s) C:\Users\Aman\Desktop\dotnet\opentelemetry-dotnet\test\OpenTelemetry.Api.Tests\bin\Debug\net8.0\OpenTelemetry.Api.Tests.dll : error TESTRUNABORT: Test Run Aborted.

Similar errors. If the required version is  .NET SDK  9 then why does the test keeps referring to version 8? The command: 
`**dotnet --list-sdks**

9.0.100-rc.1.24452.12 [C:\Program Files\dotnet\sdk]

dotnet --list-runtimes Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]`

What did I miss?

Annosha commented 22 hours ago

@TimothyMothra do I need to install these dependencies explicitly individually to set up dev env?

OpenTelemetry OpenTelemetry.Extensions.Hosting OpenTelemetry.Api OpenTelemetry.Instrumentation.AspNetCore OpenTelemetry.Exporter.Console

Although it's not mention in CONTRIBUTING.md to install these dependencies in order to contribute to the project? What dependencies do I need to install to be able to setup dev env?

Note: As a beginner I apologize for asking silly questions. I'm a newbie trying to contribute to Otel.dotnet. Thank you.