From 7564ec34db313bd41459defcdccf43fa03a8fe32 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 10 Feb 2020 20:06:55 +0100 Subject: munin: Add polyline compression ratio --- lib/Travelynx/Command/munin.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Travelynx/Command/munin.pm b/lib/Travelynx/Command/munin.pm index aeb7bff..01f5a0e 100644 --- a/lib/Travelynx/Command/munin.pm +++ b/lib/Travelynx/Command/munin.pm @@ -11,7 +11,7 @@ sub query_to_munin { my ( $label, $value ) = @_; if ( defined $value ) { - printf( "%s.value %d\n", $label, $value ); + printf( "%s.value %f\n", $label, $value ); } } @@ -58,6 +58,12 @@ sub run { ); query_to_munin( 'polylines', $db->select( 'polylines', 'count(*) as count' )->hash->{count} ); + query_to_munin( + 'polyline_ratio', + $db->query( +'select (select count(polyline_id) from journeys)::float / (select count(*) from polylines) as ratio' + )->hash->{ratio} + ); } 1; -- cgit v1.2.3