示例#1
0
    def _on_span_generation_known(self, span: opentracing.Span) -> None:
        if self._consumer:
            coordinator = self._consumer._coordinator
            coordinator_id = coordinator.coordinator_id
            app_id = self.app.conf.id
            generation = coordinator.generation
            member_id = coordinator.member_id

            try:
                op_name = span.operation_name
                set_tag = span.set_tag
            except AttributeError:  # pragma: no cover
                pass  # not a real span
            else:
                trace_id_str = f'reb-{app_id}-{generation}'
                trace_id = murmur2(trace_id_str.encode())

                span.context.trace_id = trace_id
                if op_name.endswith('.REPLACE_WITH_MEMBER_ID'):
                    span.set_operation_name(f'rebalancing node {member_id}')
                set_tag('kafka_generation', generation)
                set_tag('kafka_member_id', member_id)
                set_tag('kafka_coordinator_id', coordinator_id)
                self.app._span_add_default_tags(span)
                span._real_finish()
示例#2
0
 def _on_span_cancelled_early(self, span: opentracing.Span) -> None:
     try:
         op_name = span.operation_name
     except AttributeError:
         return
     else:
         span.set_operation_name(f'{op_name} (CANCELLED)')
         span._real_finish()
示例#3
0
 def _on_span_cancelled_early(self, span: opentracing.Span) -> None:
     op_name = span.operation_name
     span.set_operation_name(f'{op_name} (CANCELLED)')
     span._real_finish()