py_zipkin/encoding/_encoders.py
def encode_span(self, v2_span):
        """Encodes the current span to thrift."""
        span = v2_span.build_v1_span()

        thrift_endpoint = thrift.create_endpoint(
            span.endpoint.port,
            span.endpoint.service_name,
            span.endpoint.ipv4,
            span.endpoint.ipv6,
        )

        thrift_annotations = thrift.annotation_list_builder(
            span.annotations,
            thrift_endpoint,
        )

        thrift_binary_annotations = thrift.binary_annotation_list_builder(
            span.binary_annotations,
            thrift_endpoint,
        )

        # Add sa/ca binary annotations
        if v2_span.remote_endpoint:
            self.encode_remote_endpoint(
                v2_span.remote_endpoint,
                v2_span.kind,
                thrift_binary_annotations,
            )

        thrift_span = thrift.create_span(
            span.id,
            span.parent_id,
            span.trace_id,
            span.name,
            thrift_annotations,
            thrift_binary_annotations,
            span.timestamp,
            span.duration,
        )

        encoded_span = thrift.span_to_bytes(thrift_span)
        return encoded_span
def encode_span(self, v2_span):
        span = v2_span.build_v1_span()

        thrift_endpoint = thrift.create_endpoint(
            span.endpoint.port,
            span.endpoint.service_name,
            span.endpoint.ipv4,
            span.endpoint.ipv6,
        )

        thrift_annotations = thrift.annotation_list_builder(
            span.annotations,
            thrift_endpoint,
        )

        thrift_binary_annotations = thrift.binary_annotation_list_builder(
            span.binary_annotations,
            thrift_endpoint,
        )

        # Add sa/ca binary annotations
        if v2_span.remote_endpoint:
            self.encode_remote_endpoint(
                v2_span.remote_endpoint,
                v2_span.kind,
                thrift_binary_annotations,
            )

        thrift_span = thrift.create_span(
            span.id,
            span.parent_id,
            span.trace_id,
            span.name,
            thrift_annotations,
            thrift_binary_annotations,
            span.timestamp,
            span.duration,
        )

        encoded_span = thrift.span_to_bytes(thrift_span)
        return encoded_span
def encode_span ( self , v2_span ) : span = v2_span . build_v1_span ( ) thrift_endpoint = thrift . create_endpoint ( span . endpoint . port , span . endpoint . service_name , span . endpoint . ipv4 , span . endpoint . ipv6 , ) thrift_annotations = thrift . annotation_list_builder ( span . annotations , thrift_endpoint , ) thrift_binary_annotations = thrift . binary_annotation_list_builder ( span . binary_annotations , thrift_endpoint , ) # Add sa/ca binary annotations if v2_span . remote_endpoint : self . encode_remote_endpoint ( v2_span . remote_endpoint , v2_span . kind , thrift_binary_annotations , ) thrift_span = thrift . create_span ( span . id , span . parent_id , span . trace_id , span . name , thrift_annotations , thrift_binary_annotations , span . timestamp , span . duration , ) encoded_span = thrift . span_to_bytes ( thrift_span ) return encoded_span
Encodes the current span to thrift.
Encodes the current span to thrift .