Exemplo n.º 1
0
def influx_udp_async(host, port, period=15.0, registry=ppc.PUSH_REGISTRY):
    client = ppc.AsyncBatchClient(
        format=ppc.InfluxFormat(registry=registry),
        transport=ppc.AioUdpTransport(host, port),
        period=period,
    )
    return _async_wrap(client)
Exemplo n.º 2
0
async def test_async_udp_gaierror(caplog):
    transport = ppc.AioUdpTransport("X-does-not-exist-X-123", 1)
    with caplog.at_level(logging.INFO):
        await transport.start()

    assert any(lr.name == "prometheus.udp" and any(
        isinstance(a, socket.gaierror) for a in lr.args)
               for lr in caplog.records)

    # does not raise
    await transport.push_all([b"1", b"2"])
Exemplo n.º 3
0
def statsd_udp_aiostream(host, port, registry=ppc.PUSH_REGISTRY):
    client = ppc.AsyncStreamingClient(
        format=ppc.StatsdFormat(registry=registry),
        transport=ppc.AioUdpTransport(host, port),
    )
    return _async_wrap(client)