Skip to content

Commit

Permalink
use AppEngine CloudTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximillian Dornseif committed Nov 25, 2016
1 parent c0f3892 commit 527d954
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resttest_dsl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import optparse
import os
import random
import sys
import time
import urlparse
Expand Down Expand Up @@ -100,6 +101,9 @@ def fail(self, message):
else:
print repr(self.content[:50])
print '=' * 50
if 'X-Cloud-Trace-Context' in self.headers:
print ('http://console.developer.google.com/traces/details/%s'
% self.headers['X-Cloud-Trace-Context'].split(';')[0])
print

def succeed(self, message):
Expand Down Expand Up @@ -258,7 +262,10 @@ def GET(self, path, auth=None, accept=None, headers={}, **kwargs):
if auth and auth not in self.authdict:
raise ValueError("Unknown auth '%s'" % auth)

myheaders = {'User-Agent': 'resttest/%s' % requests.utils.default_user_agent()}
self.cloudtrace = "%032x" % (random.getrandbits(128))
myheaders = {
'User-Agent': 'resttest/%s' % requests.utils.default_user_agent(),
'X-Cloud-Trace-Context': '%s/0;o=1' % self.cloudtrace}
if accept:
myheaders['Accept'] = accept
myheaders.update(headers)
Expand Down

0 comments on commit 527d954

Please sign in to comment.