lightstep_binary_propagator.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:lightstep-tracer-python 作者: lightstep 项目源码 文件源码
def inject(self, span_context, carrier):
        if type(carrier) is not bytearray:
            raise InvalidCarrierException()

        state = BinaryCarrier()
        basic_ctx = state.basic_ctx

        basic_ctx.trace_id = span_context.trace_id
        basic_ctx.span_id = span_context.span_id
        basic_ctx.sampled = span_context.sampled
        if span_context.baggage is not None:
            for key in span_context.baggage:
                basic_ctx.baggage_items[key] = span_context.baggage[key]


        serializedProto = state.SerializeToString()
        encoded = standard_b64encode(serializedProto)
        carrier.extend(encoded)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号