【发布时间】:2017-07-21 20:48:26
【问题描述】:
我在 Azure 门户中设置了 AppllicationInsights 资源。有 2 个服务写入它:本地 Windows 服务和在本地服务结构集群上运行的服务结构服务。我在两个服务中都使用 TelemetryClient 对象将数据发送到 Azure ApplicationInsights 资源。看起来我收到了我想要的所有消息,但有些消息的来源我不明白。这是奇怪消息的示例:
AI:收集 6 个已配置的性能计数器时出错。请 检查配置。计数器\ASP.NET Applications(??APP_W3SVC_PROC??)\Requests/Sec: 未能执行 首先读取性能计数器。请确保它存在。 类别:ASP.NET 应用程序,计数器:Requests/Sec,实例 SFAIUsingSrv.exe
Counter .NET CLR Exceptions(??APP_CLR_PROC??)# of Exceps Throw / sec: 未能执行第一次读取以提高性能 柜台。请确保它存在。类别:.NET CLR 异常, 计数器:# of Exceps Thrown / sec,实例
计数器 \ASP.NET Applications(??APP_W3SVC_PROC??)\Request Execution Time: 未能执行性能计数器的第一次读取。请确保它 存在。类别:ASP.NET 应用程序,计数器:请求执行 时间,实例 SFAIUsingSrv.exe
.Counter \ASP.NET Applications(??APP_W3SVC_PROC??)\Requests In Application Queue: 失败 执行性能计数器的第一次读取。请确保它 存在。类别:ASP.NET 应用程序,计数器:Requests In 应用程序队列,实例 SFAIUsingSrv.exe
Counter \Process(??APP_W3SVC_PROC??)\Handle Count: 未能执行第一个 读取性能计数器。请确保它存在。类别: 进程、计数器:Handle Count、实例 SFAIUsingSrv.exe
计数器 \ASP.NET 应用程序(??APP_W3SVC_PROC??)\Requests/Sec: 失败 执行性能计数器的第一次读取。请确保它 存在。类别:ASP.NET 应用程序,计数器:Requests/Sec, 实例 SFAIUsingSrv.exe
这是我的 Service Fabric 服务的 ApplicationInsights.config:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<InstrumentationKey>some instrumentation key</InstrumentationKey>
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<!--
Requests to the following hostnames will not be modified by adding correlation headers.
This is only applicable if Profiler is installed via either StatusMonitor or Azure Extension.
Add entries here to exclude additional hostnames.
NOTE: this configuration will be lost upon NuGet upgrade.
-->
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
<Add>localhost</Add>
<Add>127.0.0.1</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">
<!--</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.FirstChanceExceptionStatisticsTelemetryModule, Microsoft.AI.WindowsServer">
-->
</Add>
</TelemetryModules>
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<ExcludedTypes>Event</ExcludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<IncludedTypes>Event</IncludedTypes>
</Add>
</TelemetryProcessors>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
-->
</ApplicationInsights>
谁能帮我理解为什么我会收到这些消息?
编辑: 产生这些消息的是我的服务(Windows 服务和服务结构服务)。这两个服务都在我的开发箱上运行。因此,当没有使用任何 Web 应用程序时,看到这些与 Web 应用程序相关的消息非常令人困惑。但是后来我在 ApplicationInsights.config 文件中注释掉了 PerformanceCounterCollector 部分消息不再产生,如果我能找到一种方法以更友好的方式处理这些消息,我将更新我的问题。
EDIT2: 这些消息仅在服务启动时显示。
【问题讨论】:
-
看起来它正在尝试跟踪来自 w3Svc 的指标,这通常是负责在 IIS 上代理 Web 流量的可执行文件/进程。如果您实施的服务不使用该流程,人工智能将在跟踪这些指标时遇到麻烦。我的猜测是 Windows Service 和 Service Fabric 可能不会公开该过程。忽略它可能是安全的......编辑:您可以在它正在寻找的配置中看到“APP_W3SVC_PROC”。
-
@Porschiey 好吧,产生这些消息的是服务,而不是网络应用程序。我已经一起删除了 counters 集合来解决这个问题。
标签: azure azure-application-insights azure-performancecounters