I am trying to add OpenTelemetry for .NET framework applications hosted in IIS using https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation?tab=readme-ov-file documentation while checking the log files I can see lots of similar errors.
Code:
<code>$appPools = Get-IISAppPool
$appPoolNames = $appPools.Name
$appPoolNames.Count
foreach($appPoolName in $appPoolNames)
{
if($appPoolName -ne "DefaultAppPool")
{
$appcmd = "$($env:systemroot)system32inetsrvAppCmd.exe"
$appPool = $appPoolName
$environment = @{
OTEL_RESOURCE_ATTRIBUTES="name=$appPool,service.version=1.0.0"
OTEL_SERVICE_NAME=$appPool
COR_ENABLE_PROFILING=1
COR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}"
COR_PROFILER_PATH_64="C:Program Filesopentelemetry-dotnet-instrumentation-windowswin-x64OpenTelemetry.AutoInstrumentation.Native.dll"
OTEL_DOTNET_AUTO_HOME="C:Program Filesopentelemetry-dotnet-instrumentation-windows"
OTEL_EXPORTER_OTLP_ENDPOINT=<URL>
OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED="true"
}
$environment.Keys | ForEach-Object {
& $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}
}
}
</code>
<code>$appPools = Get-IISAppPool
$appPoolNames = $appPools.Name
$appPoolNames.Count
foreach($appPoolName in $appPoolNames)
{
if($appPoolName -ne "DefaultAppPool")
{
$appcmd = "$($env:systemroot)system32inetsrvAppCmd.exe"
$appPool = $appPoolName
$environment = @{
OTEL_RESOURCE_ATTRIBUTES="name=$appPool,service.version=1.0.0"
OTEL_SERVICE_NAME=$appPool
COR_ENABLE_PROFILING=1
COR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}"
COR_PROFILER_PATH_64="C:Program Filesopentelemetry-dotnet-instrumentation-windowswin-x64OpenTelemetry.AutoInstrumentation.Native.dll"
OTEL_DOTNET_AUTO_HOME="C:Program Filesopentelemetry-dotnet-instrumentation-windows"
OTEL_EXPORTER_OTLP_ENDPOINT=<URL>
OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED="true"
}
$environment.Keys | ForEach-Object {
& $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}
}
}
</code>
$appPools = Get-IISAppPool
$appPoolNames = $appPools.Name
$appPoolNames.Count
foreach($appPoolName in $appPoolNames)
{
if($appPoolName -ne "DefaultAppPool")
{
$appcmd = "$($env:systemroot)system32inetsrvAppCmd.exe"
$appPool = $appPoolName
$environment = @{
OTEL_RESOURCE_ATTRIBUTES="name=$appPool,service.version=1.0.0"
OTEL_SERVICE_NAME=$appPool
COR_ENABLE_PROFILING=1
COR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}"
COR_PROFILER_PATH_64="C:Program Filesopentelemetry-dotnet-instrumentation-windowswin-x64OpenTelemetry.AutoInstrumentation.Native.dll"
OTEL_DOTNET_AUTO_HOME="C:Program Filesopentelemetry-dotnet-instrumentation-windows"
OTEL_EXPORTER_OTLP_ENDPOINT=<URL>
OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED="true"
OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED="true"
}
$environment.Keys | ForEach-Object {
& $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}
}
}
Error:
<code>EventSource=OpenTelemetry-AutoInstrumentation, Message=The profiler has been initialized with 0 derived definitions.
EventSource=OpenTelemetry-Api, Message=Failed to inject activity context in format: 'TraceContextPropagator', context: 'Invalid context'.
</code>
<code>EventSource=OpenTelemetry-AutoInstrumentation, Message=The profiler has been initialized with 0 derived definitions.
EventSource=OpenTelemetry-Api, Message=Failed to inject activity context in format: 'TraceContextPropagator', context: 'Invalid context'.
</code>
EventSource=OpenTelemetry-AutoInstrumentation, Message=The profiler has been initialized with 0 derived definitions.
EventSource=OpenTelemetry-Api, Message=Failed to inject activity context in format: 'TraceContextPropagator', context: 'Invalid context'.
Could anyone help me to fix it or suggest solution.