コード例 #1
0
def test_tcollector_submit(trace_server):
    tchannel = TChannel(name='test', known_peers=[trace_server.hostport])

    trace = Trace(endpoint=Endpoint("1.0.0.1", 1111, "tcollector"))
    anns = [client_send()]

    results = yield TChannelZipkinTracer(tchannel).record([(trace, anns)])

    assert results[0].ok
コード例 #2
0
 def __init__(
     self,
     description=None,
     id=None,
     tracing=None,
 ):
     super(TChannelError, self).__init__(description)
     self.tracing = tracing or Trace()
     self.id = id
     self.description = description
コード例 #3
0
def test_build_raw_response_message():
    message_factory = MessageFactory()
    resp = Response(
        flags=FlagsType.none,
        code=StatusCode.ok,
        headers={},
        tracing=Trace(),
        id=1111,
    )
    resp.state = StreamState.init
    message = message_factory.build_raw_response_message(resp, None, True)
    assert message.code == resp.code
    assert message.flags == resp.flags
    assert message.id == resp.id
    assert message.headers == resp.headers
コード例 #4
0
def test_span_host_field():
    tchannel = TChannel('test')
    tchannel.listen()

    tracer = TChannelZipkinTracer(tchannel)
    host_span = tracer.parse_host_port()
    thrift_obj = thrift_formatter(
        trace=Trace(name='test', endpoint=Endpoint('0.0.0.1', 90, 'test1')),
        annotations=[annotation.client_send()],
        isbased64=False,
        span_host=host_span,
    )

    assert thrift_obj.spanHost.ipv4 == ipv4_to_int(host_span.ipv4)
    assert thrift_obj.spanHost.port == host_span.port
    assert thrift_obj.spanHost.serviceName == host_span.service_name