我读过天蓝色的文件(https://docs.microsoft.com/en-us/azure/azure-monitor/app/sampling)。有.Net和Java的例子以及客户端的Javascript。但无法看到node.js(后端)的示例。
如何使用Node.js(后端)禁用Azure Application Insights中的采样
根据这个doc:
默认情况下,SDK会将所有收集的数据发送到Application Insights服务。
因此默认情况下禁用采样。
您还可以使用以下代码通过将samplingPercentage设置为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();