AI: Server telemetry channel was not initialized
See original GitHub issueHi AI Team,
I am trying to instrument my service using AI but I am not getting the server metrics in the server. This TRACE message shows up in the “Search” in AI portal but I can’t figure why or how to fix this. The only thing we did special is to override the cloudRoleName using customer initializer so we can see multiple instances of same service in the single application map.
Trace Message
AI: Server telemetry channel was not initialized. So persistent storage is turned off. You need to call ServerTelemetryChannel.Initialize(). Currently monitoring will continue but if telemetry cannot be sent it will be dropped.
AI Portal
Live Metrics shows the server is listed but CPU, RAM etc… is N/A Server performance metrics - N/A, NOT OK Dependencies tracking - OK Custom events - OK
package.config
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.5.1" targetFramework="net461" />
Program.cs
//active telemery for application performance monitoring
TelemetryConfiguration.Active.TelemetryInitializers.Add(new ServiceNameInitializer(serviceSettings.ServiceName));
TelemetryConfiguration.Active.DisableTelemetry = !serviceSettings.TelemetryAiEnabled;
TelemetryConfiguration.Active.InstrumentationKey = serviceSettings.TelemetryAiInstrumentationKey;
ServiceNameInitializer
public class ServiceNameInitializer : ITelemetryInitializer
{
private readonly string _serviceName;
public ServiceNameInitializer(string serviceName)
{
_serviceName = serviceName;
}
public void Initialize(ITelemetry telemetry)
{
telemetry.Context.Cloud.RoleName = _serviceName;
}
}
Additional Info:
I use Serilog sinks into AI and this perhaps explains why the server shows up in the Live Metrics maybe the Server Telemetry actually never worked in my case?
When I run the same service on my local machine, the server perf counters (RAM, CPU, etc) appears in AI portal.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
We figured out that this problem most likely caused by Application Insights Profiler, not Application Insights itself. There is no workaround except waiting for an update for Azure Web App extension.
@pharring do you have an estimation for this to be fixed?
Thanks @pharring!