@@ -388,23 +388,15 @@ class Collector:
388
388
Args:
389
389
thrift_url: URL of the Jaeger HTTP Thrift.
390
390
auth: Auth tuple that contains username and password for Basic Auth.
391
- client: Class for creating a Jaeger collector client.
392
- http_transport: Class for creating new client for Thrift HTTP server.
393
391
"""
394
392
395
- def __init__ (
396
- self ,
397
- thrift_url = "" ,
398
- auth = None ,
399
- client = jaeger .Client ,
400
- http_transport = THttpClient .THttpClient ,
401
- ):
393
+ def __init__ (self , thrift_url = "" , auth = None ):
402
394
self .thrift_url = thrift_url
403
395
self .auth = auth
404
- self .http_transport = http_transport (uri_or_host = thrift_url )
405
- self .client = client (
406
- iprot = TBinaryProtocol .TBinaryProtocol (trans = self .http_transport )
396
+ self .http_transport = THttpClient .THttpClient (
397
+ uri_or_host = self .thrift_url
407
398
)
399
+ self .protocol = TBinaryProtocol .TBinaryProtocol (self .http_transport )
408
400
409
401
# set basic auth header
410
402
if auth is not None :
@@ -419,18 +411,13 @@ def submit(self, batch: jaeger.Batch):
419
411
Args:
420
412
batch: Object to emit Jaeger spans.
421
413
"""
422
- try :
423
- self .client .submitBatches ([batch ])
424
- # it will call http_transport.flush() and
425
- # status code and message will be updated
426
- code = self .http_transport .code
427
- msg = self .http_transport .message
428
- if code >= 300 or code < 200 :
429
- logger .error (
430
- "Traces cannot be uploaded; HTTP status code: %s, message %s" ,
431
- code ,
432
- msg ,
433
- )
434
- finally :
435
- if self .http_transport .isOpen ():
436
- self .http_transport .close ()
414
+ batch .write (self .protocol )
415
+ self .http_transport .flush ()
416
+ code = self .http_transport .code
417
+ msg = self .http_transport .message
418
+ if code >= 300 or code < 200 :
419
+ logger .error (
420
+ "Traces cannot be uploaded; HTTP status code: %s, message: %s" ,
421
+ code ,
422
+ msg ,
423
+ )
0 commit comments