如何在开发人员模式下为Javascript(node.js)运行Azure Application Insights

问题描述 投票:1回答:3

我已经阅读了Azure中的文档(https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#debug)但是无法看到如何为应用程序洞察启用开发人员模式。

如何在Azure Application Insights中为node.js启用开发人员模式?

node.js azure azure-application-insights
3个回答
2
投票

根据源代码here

enter image description here

然后在您的代码中,您应该使用如下代码:

const appInsights = require("applicationinsights");
appInsights.setup("<instrumentation_key>").setInternalLogging(true, true);
appInsights.start();

1
投票

根据官方文档(https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#debug),目前只有C#和Visual Basic支持应用程序洞察的开发者模式


1
投票

.NET Application Insights SDK中的开发人员模式执行了一些操作,主要是启用调试消息和禁用遥测的批处理。

虽然Node SDK没有执行此操作的单个设置,但您可以通过同时使用以下两个设置来获得相同的行为:

appInsights.setup(...).setInternalLogging(true, true)启用调试消息

appInsights.defaultClient.config.maxBatchSize = 1禁用批处理

对于第二个命令,如果您已实例化自己的,请确保将appInsights.defaultClient替换为您自己的TelemetryClient实例。

© www.soinside.com 2019 - 2024. All rights reserved.