26
26
)
27
27
from BaseHTTPServer import BaseHTTPRequestHandler , HTTPServer
28
28
29
-
30
29
import opentracing
31
30
import opentracing .ext .tags
32
31
import lightstep
35
34
class RemoteHandler (BaseHTTPRequestHandler ):
36
35
"""This handler receives the request from the client.
37
36
"""
37
+
38
38
def do_GET (self ):
39
39
with before_answering_request (self , opentracing .tracer ) as server_span :
40
-
41
40
server_span .log_event ('request received' , self .path )
42
41
43
42
self .send_response (200 )
@@ -82,8 +81,8 @@ def before_answering_request(handler, tracer):
82
81
span = None
83
82
if extracted_context :
84
83
span = tracer .start_span (
85
- operation_name = operation ,
86
- child_of = extracted_context )
84
+ operation_name = operation ,
85
+ child_of = extracted_context )
87
86
else :
88
87
print ('ERROR: Context missing, starting new trace' )
89
88
global _exit_code
@@ -117,15 +116,15 @@ def lightstep_tracer_from_args():
117
116
"""
118
117
parser = argparse .ArgumentParser ()
119
118
parser .add_argument ('--token' , help = 'Your LightStep access token.' ,
120
- default = '{your_access_token}' )
119
+ default = '{your_access_token}' )
121
120
parser .add_argument ('--host' , help = 'The LightStep reporting service host to contact.' ,
122
- default = 'collector.lightstep.com' )
121
+ default = 'collector.lightstep.com' )
123
122
parser .add_argument ('--port' , help = 'The LightStep reporting service port.' ,
124
- type = int , default = 443 )
123
+ type = int , default = 443 )
125
124
parser .add_argument ('--no_tls' , help = 'Disable TLS for reporting' ,
126
125
dest = "no_tls" , action = 'store_true' )
127
126
parser .add_argument ('--component_name' , help = 'The LightStep component name' ,
128
- default = 'TrivialExample' )
127
+ default = 'TrivialExample' )
129
128
args = parser .parse_args ()
130
129
131
130
if args .no_tls :
@@ -134,12 +133,12 @@ def lightstep_tracer_from_args():
134
133
collector_encryption = 'tls'
135
134
136
135
return lightstep .Tracer (
137
- component_name = args .component_name ,
138
- access_token = args .token ,
139
- collector_host = args .host ,
140
- collector_port = args .port ,
141
- collector_encryption = collector_encryption ,
142
- )
136
+ component_name = args .component_name ,
137
+ access_token = args .token ,
138
+ collector_host = args .host ,
139
+ collector_port = args .port ,
140
+ collector_encryption = collector_encryption ,
141
+ )
143
142
144
143
145
144
if __name__ == '__main__' :
0 commit comments