line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
73
|
use strict; |
|
13
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
521
|
|
2
|
13
|
|
|
13
|
|
59
|
use warnings; |
|
13
|
|
|
|
|
17
|
|
|
13
|
|
|
|
|
825
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Monitor::MetricsAPI::Server; |
5
|
|
|
|
|
|
|
$Monitor::MetricsAPI::Server::VERSION = '0.900'; |
6
|
13
|
|
|
13
|
|
7668
|
use Plack::Builder; |
|
13
|
|
|
|
|
219058
|
|
|
13
|
|
|
|
|
1219
|
|
7
|
13
|
|
|
13
|
|
7979
|
use Twiggy::Server; |
|
13
|
|
|
|
|
727734
|
|
|
13
|
|
|
|
|
608
|
|
8
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
|
7032
|
use Monitor::MetricsAPI::Server::Routes; |
|
13
|
|
|
|
|
79
|
|
|
13
|
|
|
|
|
211
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Monitor::MetricsAPI::Server - Metrics eporting server for Monitor::MetricsAPI |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
You should not interact with this module directly in your code. Please refer to |
18
|
|
|
|
|
|
|
L<Monitor::MetricsAPI> for how to integrate this service with your application. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 new ($address, $port) |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Constructs and returns a Twiggy::Server object with a single Dancer2 service |
29
|
|
|
|
|
|
|
registered at / which will handle all incoming HTTP API requests. Both $address |
30
|
|
|
|
|
|
|
and $port are optional, and will default to '0.0.0.0' and 8200, respectively. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
3
|
|
|
3
|
1
|
10
|
my ($class, $address, $port) = @_; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
50
|
|
|
11
|
$address //= '0.0.0.0'; |
38
|
3
|
|
50
|
|
|
11
|
$port //= 8200; |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
|
|
44
|
my $server = Twiggy::Server->new( |
41
|
|
|
|
|
|
|
host => $address, |
42
|
|
|
|
|
|
|
port => $port, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
$server->register_service(builder { |
45
|
3
|
|
|
3
|
|
190
|
mount '/' => Monitor::MetricsAPI::Server::Routes->to_app; |
46
|
3
|
|
|
|
|
55
|
}); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
147852
|
return $server; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHORS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Jon Sime <jonsime@gmail.com> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This software is copyright (c) 2015 by OmniTI Computer Consulting, Inc. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
60
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
63
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
64
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |