【问题标题】:How can I disable sampling in Azure Application Insights with Node.js如何使用 Node.js 在 Azure Application Insights 中禁用采样
【发布时间】:2019-03-15 07:29:28
【问题描述】:

我已阅读 azure 文档 (https://docs.microsoft.com/en-us/azure/azure-monitor/app/sampling)。有 .Net 和 Java 的例子,还有客户端的 Javascript。但看不到 node.js(后端)的示例。

如何使用 Node.js(后端)禁用 Azure Application Insights 中的采样

【问题讨论】:

  • 你在找this吗?

标签: javascript node.js azure azure-application-insights


【解决方案1】:

据此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();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-20
    • 1970-01-01
    • 2019-12-21
    • 1970-01-01
    • 2021-07-16
    • 1970-01-01
    相关资源
    最近更新 更多