当前位置: 首页>>代码示例>>Python>>正文


Python Format.BINARY属性代码示例

本文整理汇总了Python中opentracing.Format.BINARY属性的典型用法代码示例。如果您正苦于以下问题:Python Format.BINARY属性的具体用法?Python Format.BINARY怎么用?Python Format.BINARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在opentracing.Format的用法示例。


在下文中一共展示了Format.BINARY属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_inject

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_inject():
    tracer = Tracer()
    span = tracer.start_span()

    bin_carrier = bytearray()
    tracer.inject(
        span_context=span.context,
        format=Format.BINARY,
        carrier=bin_carrier)
    assert bin_carrier == bytearray()

    text_carrier = {}
    tracer.inject(
        span_context=span.context,
        format=Format.TEXT_MAP,
        carrier=text_carrier)
    assert text_carrier == {} 
开发者ID:opentracing,项目名称:opentracing-python,代码行数:19,代码来源:test_noop_span.py

示例2: _register_required_propagators

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def _register_required_propagators(self):
        from .text_propagator import TextPropagator
        from .binary_propagator import BinaryPropagator
        self.register_propagator(Format.TEXT_MAP, TextPropagator())
        self.register_propagator(Format.HTTP_HEADERS, TextPropagator())
        self.register_propagator(Format.BINARY, BinaryPropagator()) 
开发者ID:opentracing,项目名称:opentracing-python,代码行数:8,代码来源:tracer.py

示例3: test_binary_propagation

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_binary_propagation(self):
        with self.tracer().start_span(operation_name='Bender') as span:
            bin_carrier = bytearray()
            self.tracer().inject(
                span_context=span.context,
                format=opentracing.Format.BINARY,
                carrier=bin_carrier)
            extracted_ctx = self.tracer().extract(
                format=opentracing.Format.BINARY,
                carrier=bin_carrier)
            assert extracted_ctx.baggage == {} 
开发者ID:opentracing,项目名称:opentracing-python,代码行数:13,代码来源:api_check.py

示例4: test_mandatory_formats

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_mandatory_formats(self):
        formats = [
            (Format.TEXT_MAP, {}),
            (Format.HTTP_HEADERS, {}),
            (Format.BINARY, bytearray()),
        ]
        with self.tracer().start_span(operation_name='Bender') as span:
            for fmt, carrier in formats:
                # expecting no exceptions
                span.tracer.inject(span.context, fmt, carrier)
                span.tracer.extract(fmt, carrier) 
开发者ID:opentracing,项目名称:opentracing-python,代码行数:13,代码来源:api_check.py

示例5: test_extract

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_extract():
    tracer = Tracer()
    noop_span = tracer._noop_span

    bin_carrier = bytearray()
    span_ctx = tracer.extract(Format.BINARY, carrier=bin_carrier)
    assert noop_span.context == span_ctx

    text_carrier = {}
    span_ctx = tracer.extract(Format.TEXT_MAP, carrier=text_carrier)
    assert noop_span.context == span_ctx 
开发者ID:opentracing,项目名称:opentracing-python,代码行数:13,代码来源:test_noop_span.py

示例6: __init__

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def __init__(self, enable_binary_format, recorder, scope_manager):
        """Initialize the LightStep Tracer, deferring to BasicTracer."""
        super(_LightstepTracer, self).__init__(recorder, scope_manager=scope_manager)
        self.register_propagator(Format.TEXT_MAP, TextPropagator())
        self.register_propagator(Format.HTTP_HEADERS, TextPropagator())
        if enable_binary_format:
            # We do this import lazily because protobuf versioning issues
            # can cause process-level failure at import time.
            from basictracer.binary_propagator import BinaryPropagator
            self.register_propagator(Format.BINARY, BinaryPropagator())
            self.register_propagator(LightStepFormat.LIGHTSTEP_BINARY, LightStepBinaryPropagator()) 
开发者ID:lightstep,项目名称:lightstep-tracer-python,代码行数:13,代码来源:tracer.py

示例7: register_required_propagators

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def register_required_propagators(self):
        from .text_propagator import TextPropagator
        from .binary_propagator import BinaryPropagator
        self.register_propagator(Format.TEXT_MAP, TextPropagator())
        self.register_propagator(Format.HTTP_HEADERS, TextPropagator())
        self.register_propagator(Format.BINARY, BinaryPropagator()) 
开发者ID:opentracing,项目名称:basictracer-python,代码行数:8,代码来源:tracer.py

示例8: test_tracer_extract_binary

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_tracer_extract_binary(tracer):
    with pytest.raises(opentracing.UnsupportedFormatException):
        tracer.extract(Format.BINARY, b"foo") 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:5,代码来源:tests.py

示例9: test_tracer_inject_binary

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_tracer_inject_binary(tracer):
    span_context = OTSpanContext(
        trace_parent=TraceParent.from_string("00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01")
    )
    with pytest.raises(opentracing.UnsupportedFormatException):
        tracer.inject(span_context, Format.BINARY, {}) 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:8,代码来源:tests.py

示例10: test_tracer_override_codecs

# 需要导入模块: from opentracing import Format [as 别名]
# 或者: from opentracing.Format import BINARY [as 别名]
def test_tracer_override_codecs():
    reporter = mock.MagicMock()
    sampler = ConstSampler(True)
    codecs = {
        'extra_codec': 'codec_placeholder',
        Format.BINARY: 'overridden_binary_codec'

    }
    with mock.patch('socket.gethostname', return_value='dream-host.com'):
        tracer = Tracer(service_name='x', reporter=reporter, sampler=sampler,
                        extra_codecs=codecs)
        assert tracer.codecs['extra_codec'] == 'codec_placeholder',\
                                               'Extra codec not found'
        assert tracer.codecs[Format.BINARY] == 'overridden_binary_codec',\
                                               'Binary format codec not overridden' 
开发者ID:jaegertracing,项目名称:jaeger-client-python,代码行数:17,代码来源:test_tracer.py


注:本文中的opentracing.Format.BINARY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。