GoogleCloudPlatform / cloud-profiler-python

Stackdriver Profiler Python agent is a tool that continuously gathers CPU usage information from Python applications
Apache License 2.0
28 stars 23 forks source link

Allow disabling of gce metadata lookup. #14

Closed tmc closed 5 years ago

tmc commented 5 years ago

If this package is used outside of a GCE/GKE/CloudFunction/etc. environment it produces errors like [WARNING] googlecloudprofiler.client client.py:retrieve_gce_metadata:88 | Failed to fetch instance/zone from GCE metadata server: HTTPConnectionPool(host='metadata', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/zone (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff9e40b9128>: Failed to establish a new connection: [Errno -2] Name does not resolve',))

Having an ability to disable this metadata lookup would avoid these errors.

jqll commented 5 years ago

It's a warning level log. I don't feel it's worth to provide a flag to disable this one time warning log. But let us know if you have specific concerns.