EV-ClickHouse
view release on metacpan or search on metacpan
$ch->ping_round_trip(sub {
my ($seconds, $err) = @_;
die "ping: $err" if $err;
printf "rtt = %.3fms\n", $seconds * 1000;
});
Issue a single PING and report wall-clock latency in seconds. Lighter
than installing ["track\_query\_durations"](#track_query_durations) for a one-shot probe;
returns `(undef, $err)` on transport failure. Pairs well with
["is\_healthy"](#is_healthy) for health-check endpoints that want both liveness and
latency.
## slow\_query\_log
my $prev = $ch->slow_query_log(0.1, sub {
my ($qid, $rows, $bytes, $code, $dur, $err) = @_;
warn sprintf("SLOW %.3fs %s\n", $dur, $qid // '?');
});
Filtered variant of ["on\_query\_complete"](#on_query_complete) that fires only when the
#!/usr/bin/env perl
# TLS connection â connect over a TLS-fronted ClickHouse port.
#
# Set up a TLS endpoint (e.g. with stunnel or nginx) and point this script
# at it via CLICKHOUSE_TLS_HOST / CLICKHOUSE_TLS_PORT.
use strict;
use warnings;
use EV;
use EV::ClickHouse;
my $host = $ENV{CLICKHOUSE_TLS_HOST} // 'localhost';
my $port = $ENV{CLICKHOUSE_TLS_PORT} // 9440;
my $ca = $ENV{CLICKHOUSE_TLS_CA}; # optional extra CA bundle
lib/EV/ClickHouse.pm view on Meta::CPAN
$ch->ping_round_trip(sub {
my ($seconds, $err) = @_;
die "ping: $err" if $err;
printf "rtt = %.3fms\n", $seconds * 1000;
});
Issue a single PING and report wall-clock latency in seconds. Lighter
than installing L</track_query_durations> for a one-shot probe;
returns C<(undef, $err)> on transport failure. Pairs well with
L</is_healthy> for health-check endpoints that want both liveness and
latency.
=head2 slow_query_log
my $prev = $ch->slow_query_log(0.1, sub {
my ($qid, $rows, $bytes, $code, $dur, $err) = @_;
warn sprintf("SLOW %.3fs %s\n", $dur, $qid // '?');
});
Filtered variant of L</on_query_complete> that fires only when the
( run in 0.643 second using v1.01-cache-2.11-cpan-524268b4103 )