CorrelationIdManager in an infinite loop
Hi,
I was trying to integrate telemetry to my azure pipelines task and found an issue with the CorrelationIdManager:
My agent is behind a proxy and event though the http_proxy and https_proxy environment variables are set any requests where resulting in a 504 Gateway timeout (need to investigate on my side). But the side effect was that the task was never finishing because the CorrelationIdManager.queryCorrelationId has started an infinite loop as the 504 error code would generate a retry every time.
Proposed fix (i can provide a PR):
Add a cancelCorrelationIdQueries (or dispose) method to CorrelationIdManager which will clear the pendingLookups and call this function in the applicationinsights dispose
A manual halt is fine, but maybe an upper limit on the amount of retries would be better so that others in a similar situation don't need to make code changes? It would also be depending on the response code -- I think the current behavior assumes that >=500 means a transient issue which is not the case for you. So maybe status=500 retries forever, and >500 retries up to N times? What do you think?
Hi @markwolff, I think both would be needed: a configurable number of retries and a manual halt (especially if you still have a path which could retry forever).
This is needed as you may, like me, want to deploy telemetry to a app that will be used by external users where you don't know their network configuration and don't want to have your application stale in an infinite loop because of network issues for telemetry :(
Also on the proxy part, i've done some test and can't find why on my test workstation behind a corporate proxy i can access through the browser the https://dc.services.visualstudio.com url but get a 504 when calling from nodejs with the same proxy configured :(
Is this a duplicate of #833 ?