ApplicationInsights-node.js
ApplicationInsights-node.js copied to clipboard
[Question] How to track module loading times
Hi
AI Version: 1.7.3 Node Version: 13.11.0
We are trying to investigate a performance problem with a NodeJS based backend to a website. The problem typically occurs during the first HTTP request to a webservice, and some calls are taking up to 45 seconds when they should be completing in under 1 second.
This seems to suggest that one or more modules (ie npm packages) are taking time to initialise.
If we could track how long each require('<package>')
call is taking then that would help with the investigation.
Is there an easy way to get Application Insights (AI) to do that?
I'm aware that we could try to patch require
ourselves. But my understanding was that AI was already doing that. There just doesn't seem to be a way to surface the metrics.
This is our existing configuration:
ai.setup('key')
.setAutoDependencyCorrelation(true)
.setAutoCollectRequests(true)
.setAutoCollectPerformance(true, true)
.setAutoCollectExceptions(true)
.setAutoCollectDependencies(true)
.setUseDiskRetryCaching(true)
// Disabled
.setAutoCollectConsole(false)
.setSendLiveMetrics(false);
Any idea how best to track this performance problem?
Thanks Noel