我真的很喜欢应用程序洞察,并且在 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/