We are trying to implement method-level tracing using the `splunk.opentelemetry.autoinstrumentation` package (version 1.9.0) in a .NET Core Web API application targeting .NET 9. We’ve set up the code, but we’re facing runtime issues. Despite trying various solutions, including reinstalling the `splunk.opentelemetry.autoinstrumentation` package, the issues persist. Could you please help us resolve these and suggest any necessary modifications? Do we need to add any collector? Another issue : When we set "CORECLR_ENABLE_PROFILING": "0" then we are able to see traceids in console but unable to see the traceid in splunk APM window. Error 1: System.ExecutionEngineException HResult=0x80131506 Source=<Cannot evaluate the exception source> StackTrace: <Cannot evaluate the exception stack trace> at OpenTelemetry.AutoInstrumentation.NativeMethods+Windows.AddInstrumentations(System.String, OpenTelemetry.AutoInstrumentation.NativeCallTargetDefinition[], Int32) at OpenTelemetry.AutoInstrumentation.NativeMethods.AddInstrumentations(System.String, OpenTelemetry.AutoInstrumentation.NativeCallTargetDefinition[]) at OpenTelemetry.AutoInstrumentation.Instrumentation.RegisterBytecodeInstrumentations(Payload) at OpenTelemetry.AutoInstrumentation.Instrumentation.Initialize() at DynamicClass.InvokeStub_Instrumentation.Initialize(System.Object, System.Object, IntPtr*) at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(System.Object, System.Reflection.BindingFlags) at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Reflection.MethodBase.Invoke(System.Object, System.Object[]) at OpenTelemetry.AutoInstrumentation.Loader.Loader.TryLoadManagedAssembly() at OpenTelemetry.AutoInstrumentation.Loader.Loader..cctor() at OpenTelemetry.AutoInstrumentation.Loader.Loader..ctor() at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean) at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Reflection.Assembly.CreateInstance(System.String) at StartupHook.Initialize() at System.StartupHookProvider.ProcessStartupHooks(System.String) Error 2: Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at OpenTelemetry.AutoInstrumentation.NativeMethods+Windows.AddInstrumentations(System.String, OpenTelemetry.AutoInstrumentation.NativeCallTargetDefinition[], Int32) at OpenTelemetry.AutoInstrumentation.Instrumentation.RegisterBytecodeInstrumentations(Payload) at OpenTelemetry.AutoInstrumentation.Instrumentation.Initialize() at OpenTelemetry.AutoInstrumentation.Loader.Loader.TryLoadManagedAssembly() at OpenTelemetry.AutoInstrumentation.Loader.Loader..cctor() at OpenTelemetry.AutoInstrumentation.Loader.Loader..ctor() at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean) at System.Reflection.Assembly.CreateInstance(System.String) at StartupHook.Initialize() at System.StartupHookProvider.ProcessStartupHooks() launchSettings.json: { "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:47665", "sslPort": 44339 } }, "profiles": { "WebApplication3": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "https://localhost:7146;http://localhost:5293", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "OTEL_SERVICE_NAME": "MyDotNet6WebApi", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://ingest.XX.signalfx.com/v2/trace/otlp", "OTEL_EXPORTER_OTLP_HEADERS": "X-SF-Token=fdsfsdfsd-M-fdsfsdfsd-r", "OTEL_DOTNET_AUTO_ENABLED": "true", "OTEL_DOTNET_TRACES_METHODS_INCLUDE": "WebApplication3.Controllers.SampleController.DoSomething", "OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES": "Microsoft.AspNetCore.Http,System.Net.Http", "OTEL_TRACES_EXPORTER": "otlp,console", "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf", "OTEL_DOTNET_AUTO_INSTRUMENTATION_LOGS": "true", "OTEL_DOTNET_AUTO_INSTRUMENTATION_ENABLED": "true", "CORECLR_ENABLE_PROFILING": "1", "OTEL_DOTNET_AUTO_LOG_DIRECTORY": "C:\\temp\\otel-logs", "CORECLR_PROFILER": "{918728DD-259F-4A6A-AC2C-4F76DA9F3EAB}", "DOTNET_STARTUP_HOOKS": "%USERPROFILE%\\.nuget\\packages\\opentelemetry.autoinstrumentation.startuphook\\1.10.0\\lib\\netcoreapp3.1\\OpenTelemetry.AutoInstrumentation.StartupHook.dll", "OTEL_DOTNET_AUTO_HOME": "%USERPROFILE%\\.nuget\\packages\\splunk.opentelemetry.autoinstrumentation\\1.9.0", "CORECLR_PROFILER_PATH_64": "%USERPROFILE%\\.nuget\\packages\\opentelemetry.autoinstrumentation.runtime.native\\1.10.0\\runtimes\\win-x64\\native\\OpenTelemetry.AutoInstrumentation.Native.dll", "CORECLR_PROFILER_PATH_32": "%USERPROFILE%\\.nuget\\packages\\opentelemetry.autoinstrumentation.runtime.native\\1.10.0\\runtimes\\win-x86\\native\\OpenTelemetry.AutoInstrumentation.Native.dll" } } } } SampleController.cs: using Microsoft.AspNetCore.Mvc; using System.Diagnostics; using System.Net.Http; namespace WebApplication3.Controllers { [ApiController] [Route("api/[controller]")] public class SampleController : ControllerBase { private readonly IHttpClientFactory _httpClientFactory; public SampleController(IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; } [HttpGet("execute")] public async Task<IActionResult> Execute() { await DoSomething(); var traceId = Activity.Current?.TraceId.ToString(); return Ok(new { message = "Request executed", traceId }); } [NonAction] public async Task DoSomething() { using var activity = new Activity("SampleController.DoSomething").Start(); // Internal HTTP call to another endpoint var response = await _httpClientFactory.CreateClient().GetAsync("https://jsonplaceholder.typicode.com/todos/1"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } } rapid response for Splunk Splunk Add-On for OpenTelemetry Collector
... View more