我已经阅读了天青的文档(https://docs.microsoft.com/en-us/azure/azure-monitor/app/sampling)。有.Net和Java的示例,还有客户端的Javascript。但是看不到node.js(后端)的示例。
如何使用Node.js(后端)在Azure Application Insights中禁用采样
答案 0 :(得分:1)
根据此doc:
默认情况下,SDK会将所有收集的数据发送到Application Insights服务。
因此默认情况下将禁用采样。
并且您还可以使用以下代码通过将samplesPercentage设置为0或非零值来禁用/启用采样,如下所示:
const appInsights = require("applicationinsights");
appInsights.setup("<instrumentation_key>");
appInsights.defaultClient.config.samplingPercentage = 33; // 33% of all telemetry will be sent to Application Insights
appInsights.start();