-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery Starbot ⭐ refactored AlfiyaZi/jaeger-client-python #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -395,7 +395,7 @@ def new_tracer(self, io_loop=None): | |
| if self.logging: | ||
| reporter = CompositeReporter(reporter, LoggingReporter(logger)) | ||
|
|
||
| if not self.throttler_group() is None: | ||
| if self.throttler_group() is not None: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| throttler = RemoteThrottler( | ||
| channel, | ||
| self.service_name, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,7 @@ def __init__(self, namespace='', service_name_label=None): | |
| def _get_tag_name_list(self, tags): | ||
| if tags is None: | ||
| return [] | ||
| tag_name_list = [] | ||
| for key in tags.keys(): | ||
| tag_name_list.append(key) | ||
| return tag_name_list | ||
| return [key for key in tags.keys()] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| def _get_metric(self, metricType, name, tags): | ||
| if self._service_name_label: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,5 +66,4 @@ def _update_balance(self): | |
| elapsed_time = current_time - self.last_tick | ||
| self.last_tick = current_time | ||
| self.balance += elapsed_time * self.credits_per_second | ||
| if self.balance > self.max_balance: | ||
| self.balance = self.max_balance | ||
| self.balance = min(self.balance, self.max_balance) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ def get_spans(self): | |
| class LoggingReporter(NullReporter): | ||
| """Logs all spans.""" | ||
| def __init__(self, logger=None): | ||
| self.logger = logger if logger else default_logger | ||
| self.logger = logger or default_logger | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| def report_span(self, span): | ||
| self.logger.info('Reporting span %s', span) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,14 +124,15 @@ def _set_sampling_priority(self, value): | |
|
|
||
| def log_kv(self, key_values, timestamp=None): | ||
| if self.is_sampled(): | ||
| timestamp = timestamp if timestamp else time.time() | ||
| timestamp = timestamp or time.time() | ||
| # TODO handle exception logging, 'python.exception.type' etc. | ||
| log = thrift.make_log( | ||
| timestamp=timestamp if timestamp else time.time(), | ||
| timestamp=timestamp or time.time(), | ||
| fields=key_values, | ||
| max_length=self._tracer.max_tag_value_length, | ||
| max_traceback_length=self._tracer.max_traceback_length, | ||
| ) | ||
|
|
||
|
Comment on lines
-127
to
+135
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| with self.update_lock: | ||
| self.logs.append(log) | ||
| return self | ||
|
|
@@ -165,8 +166,11 @@ def is_debug(self): | |
| def is_rpc(self): | ||
| for tag in self.tags: | ||
| if tag.key == ext_tags.SPAN_KIND: | ||
| return tag.vStr == ext_tags.SPAN_KIND_RPC_CLIENT or \ | ||
| tag.vStr == ext_tags.SPAN_KIND_RPC_SERVER | ||
| return tag.vStr in [ | ||
| ext_tags.SPAN_KIND_RPC_CLIENT, | ||
| ext_tags.SPAN_KIND_RPC_SERVER, | ||
| ] | ||
|
|
||
|
Comment on lines
-168
to
+173
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return False | ||
|
|
||
| def is_rpc_client(self): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,15 +193,19 @@ def make_ref_type(span_ref_type): | |
| def make_references(references): | ||
| if not references: | ||
| return None | ||
| list_of_span_refs = list() | ||
| for span_ref in references: | ||
| list_of_span_refs.append(ttypes.SpanRef( | ||
| return [ | ||
| ttypes.SpanRef( | ||
| refType=make_ref_type(span_ref.type), | ||
| traceIdLow=id_to_int(_id_to_low(span_ref.referenced_context.trace_id)), | ||
| traceIdHigh=id_to_int(_id_to_high(span_ref.referenced_context.trace_id)), | ||
| traceIdLow=id_to_int( | ||
| _id_to_low(span_ref.referenced_context.trace_id) | ||
| ), | ||
| traceIdHigh=id_to_int( | ||
| _id_to_high(span_ref.referenced_context.trace_id) | ||
| ), | ||
| spanId=id_to_int(span_ref.referenced_context.span_id), | ||
| )) | ||
| return list_of_span_refs | ||
| ) | ||
| for span_ref in references | ||
| ] | ||
|
Comment on lines
-196
to
+208
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def make_jaeger_batch(spans, process): | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
TUDPTransport.__init__refactored with the following changes:assign-if-exp)