使用 Application Insights 检测 windows 服务

Instrumenting windows service with Application Insights

是否可以使用 Application Insights 在内部检测 windows 服务 运行?没有必要让它像 Web 应用程序那样自动收集应用程序的指标,将自定义事件推送到 Azure 就足够了。

这完全有可能!引用 Application Insights web page:

Monitor ASP.NET or J2EE web apps hosted anywhere: on Azure, or on other cloud services, or your own on-premises servers

您只需在 Azure 门户上创建检测密钥并将匹配的 SDK 集成到您的应用程序中。然后将实际遥测数据发送到作为 Azure 的一部分托管的后端服务器。

安装Core SDK nuget。 然后创建 TelemetryClient,set instrumentation key programmatically 并开始从您想要的地方发送遥测数据。 Msdn article 描述了如何使用 AI API。 不会有自动收集,但一切都应该有效。

我会让文档在这方面更清楚一点。如果有一个可以用它构建的核心 SDK,您就可以检测任何东西。所以任何类型的 .NET,Java,PHP,OSX,iOS,Android,......如果你想要额外的模块来记录网络请求、崩溃等,你的限制有点多。

对于 Windows 本地服务,请按照您在此处看到的内容进行操作: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-windows-desktop