File: future-io-server.pl

package info (click to toggle)
libnet-prometheus-perl 0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 304 kB
  • sloc: perl: 1,768; makefile: 8
file content (25 lines) | stat: -rw-r--r-- 500 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl

use v5.20;
use warnings;

use Future::IO 0.18; # ->load_best_impl
use Metrics::Any::Adapter 'Prometheus';
use Net::Prometheus;

use constant LISTEN_PORT => 8200;

Future::IO->load_best_impl;

$Net::Prometheus::PerlCollector::DETAIL = 1;

my $client = Net::Prometheus->new;

$client->new_gauge(
   name => "ten",
   help => "The number ten",
)->set( 10 );

printf STDERR "Serving metrics on http://[::]:%d\n", LISTEN_PORT;

$client->export_to_Future_IO( port => LISTEN_PORT )->await;