microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
321 stars 138 forks source link

ApplicationInsights timesout in Azure DevOps build task (node.js) #873

Open kh-yash opened 2 years ago

kh-yash commented 2 years ago

I have developed an azure devops task extension that is installed in our pipeline. This task sends telemetry to Azure App Insights to record metrics and events. App Insights js library is throwing the following error in some of the builds.

ApplicationInsights:AzureVirtualMachine [ { Error: connect ETIMEDOUT 169.254.169.254:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '169.254.169.254', port: 80 } ]

Does anyone know what could be the potential problem? Do I need to manually flush the telemetry when my app terminates?

hectorhdzg commented 2 years ago

@kh-yash the SDK will make a call to Azure Metadata service to enhance telemetry with extra properties when running in Azure environments like App Services or Azure Functions, this doesn't affect any functionality when it fails

kh-yash commented 2 years ago

@hectorhdzg What kind of properties are these? Is there a way to prevent sending these properties to avoid seeing any such timeouts in logs?

Also, to clearly understand, are you saying that this particular timeout wouldn't break any functionality and the telemetry (custom events) that is being pushed to Application Insights would still be pushed?

hectorhdzg commented 2 years ago

@kh-yash that is correct this timeout will not break any functionality and your data must be sent, I believe this timeout will be logged only when debug logs are turned on, at least in latest version of the SDK, you can use setInternalLogging(false, true) to only enable warnings to be logged.