def _decode_binary_thrift_objs(obj): spans = [] trans = TMemoryBuffer(obj) _, size = read_list_begin(trans) for _ in range(size): span = zipkin_core.Span() span.read(TBinaryProtocol(trans)) spans.append(span) return spans
def decode_thrift(encoded_spans): spans = [] trans = TMemoryBuffer(encoded_spans) _, size = read_list_begin(trans) for _ in range(size): span_obj = zipkin_core.Span() span_obj.read(TBinaryProtocol(trans)) spans.append(span_obj) return spans
def decode_spans(self, spans): """Decodes an encoded list of spans. :param spans: encoded list of spans :type spans: bytes :return: list of spans :rtype: list of Span """ decoded_spans = [] transport = TMemoryBuffer(spans) if six.byte2int(spans) == TType.STRUCT: _, size = read_list_begin(transport) else: size = 1 for _ in range(size): span = zipkin_core.Span() span.read(TBinaryProtocol(transport)) decoded_spans.append(self._decode_thrift_span(span)) return decoded_spans
def _decode_binary_thrift_obj(obj): trans = TMemoryBuffer(obj) span = zipkin_core.Span() span.read(TBinaryProtocol(trans)) return span