【问题标题】:block some endpoints NOT to be send to application insights - nodejs阻止某些端点不发送到应用程序洞察力 - nodejs
【发布时间】:2018-08-23 19:42:42
【问题描述】:

我非常喜欢应用程序洞察力,我在 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 和 Readiness Probe(对此端点进行了很多请求),但是对这些端点的请求也被发送到应用程序洞察力,这不是我想要的因为它正在炸毁应用程序洞察帐户。

【问题讨论】:

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


    【解决方案1】:
    【解决方案2】:

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

    实现:

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

    【讨论】:

      猜你喜欢
      • 2022-07-06
      • 1970-01-01
      • 2020-11-17
      • 2016-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多