apm-agent-python icon indicating copy to clipboard operation
apm-agent-python copied to clipboard

[META 786] Do not use proxy when querying cloud metadata from APM agents

Open elastic-apm-tech opened this issue 2 years ago • 1 comments

See meta issue for the description and details:

  • Meta issue: https://github.com/elastic/apm/issues/786

elastic-apm-tech avatar Apr 19 '23 12:04 elastic-apm-tech

It looks like we're already doing this, by coincidence. We create separate connection pools where we fetch the cloud metadata:

https://github.com/elastic/apm-agent-python/blob/d19c5ff5c0de0dc526d59e7e044194da37f36f2b/elasticapm/utils/cloud.py#L43 https://github.com/elastic/apm-agent-python/blob/d19c5ff5c0de0dc526d59e7e044194da37f36f2b/elasticapm/utils/cloud.py#L95 https://github.com/elastic/apm-agent-python/blob/d19c5ff5c0de0dc526d59e7e044194da37f36f2b/elasticapm/utils/cloud.py#L134

In contrast, the connection pool used in the transport explicitly sets up a ProxyManager if the HTTP[S]_PROXY environment variable is set.

https://github.com/elastic/apm-agent-python/blob/d19c5ff5c0de0dc526d59e7e044194da37f36f2b/elasticapm/transport/http.py#L124-L129

@basepi agree to close this as completed? Or should we add comments in utils/cloud.py to not use ProxyManager there, just in case?

beniwohli avatar Apr 19 '23 13:04 beniwohli