Node.js 阻止某些端点不发送到application insights-NodeJ
我非常喜欢应用程序洞察,并将其用于nodeJs应用程序。 这是我在express.js中的内容Node.js 阻止某些端点不发送到application insights-NodeJ,node.js,azure,azure-application-insights,Node.js,Azure,Azure Application Insights,我非常喜欢应用程序洞察,并将其用于nodeJs应用程序。 这是我在express.js中的内容 const appInsights = require('applicationinsights') appInsights.setup() .setAutoDependencyCorrelation(true) .setAutoCollectRequests(true) .setAutoCollectPerformance(true) .setAutoCollectE
const appInsights = require('applicationinsights')
appInsights.setup()
.setAutoDependencyCorrelation(true)
.setAutoCollectRequests(true)
.setAutoCollectPerformance(true)
.setAutoCollectExceptions(true)
.setAutoCollectDependencies(true)
.setAutoCollectConsole(true)
.setUseDiskRetryCaching(true)
.start();
一切正常。但我希望某些特定的请求不会发送到application insights
我在kubernetes集群中运行该应用程序,并配置了一个活动性和就绪性探测器(对该端点执行了大量请求),但是对这些端点的请求也被发送到application insights,这不是我想要的,因为它正在破坏application insights帐户。您可以使用遥测处理器过滤掉那些不希望发送的请求。 看看这个: 通用文档(主要是.net)
谢谢你的回答。我可以使用您提供的链接进行更改 实施:
function removeStackTraces ( envelope, context ) {
var data = envelope.data.baseData;
if (data.url && data.url.includes("health") )
{
return false;
}
return true;
}
appInsights.defaultClient.addTelemetryProcessor(removeStackTraces);