node.js - 阻止某些端点不发送到应用程序洞察 - nodejs

标签 node.js azure azure-application-insights

我真的很喜欢应用程序洞察,并且在 NodeJs 应用程序中使用它。 这就是我的express.js 中的内容

const appInsights = require('applicationinsights')
appInsights.setup()
    .setAutoDependencyCorrelation(true)
    .setAutoCollectRequests(true)
    .setAutoCollectPerformance(true)
    .setAutoCollectExceptions(true)
    .setAutoCollectDependencies(true)
    .setAutoCollectConsole(true)
    .setUseDiskRetryCaching(true)
    .start();

一切正常。但我希望一些特定请求不要发送到应用程序洞察

我在 kubernetes 集群中运行应用程序,并配置了 Liveness and Readiness Probe(许多请求是对此端点执行的),但对这些端点的请求也会发送到应用程序洞察,这不是我想要的因为它正在爆破应用程序洞察帐户。

最佳答案

谢谢你的回答。我可以使用您提供的链接进行更改。

实现:

function removeStackTraces ( envelope, context ) {

  var data = envelope.data.baseData;  
  if (data.url && data.url.includes("health") )
  {
      return false;
  }
   return true;
}
 appInsights.defaultClient.addTelemetryProcessor(removeStackTraces);

关于node.js - 阻止某些端点不发送到应用程序洞察 - nodejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51993221/

相关文章:

javascript - 如何从 github 导入 React 组件?

azure - 如何为 Azure 托管网站/Web 角色设置 A 记录?

json - 如何在Azure数据工厂复制事件中设置Content-Type?

node.js - Azure管道问题-node.js版本

javascript - Grunt 任务退出并出现总线错误 : 10

logging - 如何使应用程序洞察仅存储异常和自定义事件

azure - 从 .NET Core 添加自定义维度到 Application Insights 跟踪

c# - 给定一个Applications Insight Instrumentation key ,获取Azure中的服务名称

javascript - 在快速 route ,为什么使用 `./routes` 而不是 `/routes` ?

Azure 存储类型提供程序 : FS0039 on build but intellisense shows type as available