Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lachmatt committed Oct 16, 2023
1 parent 4275374 commit 4553d4a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#if NET6_0_OR_GREATER

using System.Reflection;
using System.Security;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenTelemetry.AutoInstrumentation.Configurations;
Expand Down Expand Up @@ -165,8 +166,15 @@ private static bool IsExtensionsHostingAssembly(Assembly assembly)

private static bool IsAutoInstrumentationStartupAssemblySet()
{
var environmentVariable = Environment.GetEnvironmentVariable("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES");
return environmentVariable != null && environmentVariable.Contains("OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper", StringComparison.OrdinalIgnoreCase);
try
{
var environmentVariable = Environment.GetEnvironmentVariable("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES");
return environmentVariable != null && environmentVariable.Contains("OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper", StringComparison.OrdinalIgnoreCase);
}
catch (SecurityException)
{
return false;
}
}
}
#endif

0 comments on commit 4553d4a

Please sign in to comment.