line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
15188364
|
use strict; |
|
7
|
|
|
|
|
31
|
|
|
7
|
|
|
|
|
399
|
|
2
|
7
|
|
|
7
|
|
52
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
833
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Measure::Everything::Adapter::InfluxDB::UDP; |
5
|
|
|
|
|
|
|
# ABSTRACT: A Measure::Everything adapter to feed InfluxDB through UDP. |
6
|
|
|
|
|
|
|
$Measure::Everything::Adapter::InfluxDB::UDP::VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
476
|
use IO::Socket::INET; |
|
7
|
|
|
|
|
14043
|
|
|
7
|
|
|
|
|
326
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
5383
|
use base qw(Measure::Everything::Adapter::Base); |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
1437
|
|
11
|
7
|
|
|
7
|
|
3343
|
use InfluxDB::LineProtocol qw(data2line); |
|
7
|
|
|
|
|
26994
|
|
|
7
|
|
|
|
|
43
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
6
|
|
|
6
|
0
|
182
|
my $self = shift; |
15
|
6
|
|
|
|
|
24
|
my %config = @_; |
16
|
|
|
|
|
|
|
my $socket = IO::Socket::INET->new( |
17
|
|
|
|
|
|
|
PeerAddr => $config{host} || $config{addr} || 'localhost', |
18
|
6
|
|
0
|
|
|
113
|
PeerPort => $config{port} || 8089, |
|
|
|
50
|
|
|
|
|
19
|
|
|
|
|
|
|
Proto => 'udp', |
20
|
|
|
|
|
|
|
ReuseAddr => 1, |
21
|
|
|
|
|
|
|
); |
22
|
6
|
|
|
|
|
2837
|
$self->{socket} = $socket; |
23
|
6
|
|
|
|
|
22
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub write { |
27
|
6
|
|
|
6
|
0
|
6000898
|
my $self = shift; |
28
|
6
|
|
|
|
|
52
|
my $line = data2line(@_); |
29
|
6
|
|
|
|
|
992
|
return $self->{socket}->send( $line ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |