open-telemetry / opentelemetry-dotnet-instrumentation

OpenTelemetry .NET Automatic Instrumentation
https://opentelemetry.io
Apache License 2.0
368 stars 92 forks source link

Support for .NET 9 #3766

Open stevejgordon opened 5 days ago

stevejgordon commented 5 days ago

Feature Request

Is your feature request related to a problem? Please describe.

Enabling auto instrumentation for a .NET 9 application currently fails as there is no net9.0 directory in the store.

[StartupHook] [2024-11-13T09:19:46.9432178Z] [Warning] Rule Engine: Couldn't evaluate reference to runtime store assemblies in an app.
Exception: Could not find a part of the path '/app/otel/store/x64/net9.0'.
System.IO.DirectoryNotFoundException: Could not find a part of the path '/app/otel/store/x64/net9.0'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at OpenTelemetry.AutoInstrumentation.RulesEngine.RuntimeStoreDiagnosticRule.Evaluate() in /_/src/OpenTelemetry.AutoInstrumentation.StartupHook/RulesEngine/RuntimeStoreDiagnosticRule.cs:line 41

Describe the solution you'd like

Support for .NET 9

Additional context Add any other context or screenshots about the feature request here.

Is there a timeframe for supporting .NET 9 now that it has gone GA?

Kielek commented 4 days ago

@stevejgordon, first we need to do some work on https://github.com/open-telemetry/opentelemetry-dotnet-contrib repository. I hope, most of this things will be ready next week.

The tentative schedule for the release this project is end of November.

Adding this to Milestone 1.10.0.

stevejgordon commented 4 days ago

Okay, thanks, @Kielek. If there's any low-hanging fruit I can assist with next week, I'd likely have time to contribute.

I need to investigate further, but I ran into issues with auto instrumentation after updating our WIP distro to 1.10, which includes a plugin we register for the auto instrumentation. I've not looked deep enough yet, but my theory is that the bundling of 1.9 in the profiler might be causing the mismatch and leading to a TypeLoadException for our code. I'll wait for the 1.10 and try again.

pellared commented 4 days ago

Possibly related issue https://github.com/open-telemetry/opentelemetry-dotnet/issues/5973

Kielek commented 3 days ago

@pellared, the root cause of the issue, is the lack of the additional store in /app/otel/store/x64/net9.0. In this folder you should have already net6.0/net7.0/net8.0.

@stevejgordon, there is couple things we should change, most of them are related to our build-pipeline/dependencies. Please check following list:

Nice to have maintenance tasks in OTel .NET Contrib:

Blockers:

Probably some other stuff.

I think that it for you, it will be easier to help on contrib side. Like https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/2071.

I will be happy to include you in all PRs in this repository also. We will need a help in the next year for .NET10 support. It will be easier to follow examples (next week probably).

Please let me know what do you think about this.