コード例 #1
0
def make_endpoint(ipv4, port, service_name):
    if isinstance(ipv4, basestring):
        ipv4 = ipv4_to_int(ipv4)
    port = port_to_int(port)
    if port is None:
        port = 0
    return zipkin_collector.Endpoint(ipv4, port, service_name.lower())
コード例 #2
0
def test_make_endpoint():
    endpoint1 = thrift.make_endpoint(ipv4='localhost', port='',
                                     service_name='XYZ')
    target = zipkin_collector.Endpoint(
        ipv4=127 << 24 | 1, port=0, service_name='xyz')
    assert endpoint1 == target

    endpoint2 = thrift.make_endpoint(ipv4='127.0.0.1', port='',
                                     service_name='XYZ')
    assert endpoint2 == target