Skip to content

Commit

Permalink
add metadata header
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Prin committed Feb 21, 2017
1 parent c4c70df commit 0c9954e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions logging/google/cloud/logging/_shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def _fetch_metadata(metdata_path):
url = 'http://{}/computeMetadata/v1/{}'.format(_METADATA_SERVICE_ADDR,
metdata_path)
h = httplib2.Http()
headers = {'Metadata-Flavor': 'Google'}
resp, content = h.request(url, 'GET')

return content


Expand All @@ -48,12 +50,12 @@ def _get_gae_version():
return _fetch_metadata('instance/attributes/gae_backend_version')


def _write_stacktrace_log(client, line):
def _write_stacktrace_log(client, traces):
gae_version = _get_gae_version()
gae_backend = _get_gae_backend()
gae_instance = _get_gae_instance()

text_payload = '{}\nThread traces\n{}'.format(gae_instance, line)
text_payload = '{}\nThread traces\n{}'.format(gae_instance, traces)
logger_name = 'projects/{}/logs/'
'appengine.googleapis.com%2Fapp.shutdown'.format(client.project)

Expand Down

0 comments on commit 0c9954e

Please sign in to comment.