File Coverage

blib/lib/Future/AsyncAwait/Metrics.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2022 -- leonerd@leonerd.org.uk
5              
6             package Future::AsyncAwait::Metrics 0.01;
7              
8 2     2   99811 use v5.14;
  2         12  
9 2     2   13 use warnings;
  2         5  
  2         77  
10              
11 2         12 use Metrics::Any 0.09 '$metrics',
12             name_prefix => [ 'asyncawait' ],
13 2     2   913 strict => 1;
  2         8723  
14              
15             require XSLoader;
16             XSLoader::load( __PACKAGE__, our $VERSION );
17              
18             =head1 NAME
19              
20             C - report metrics from C to C
21              
22             =head1 SYNOPSIS
23              
24             use Future::AsyncAwait::Metrics;
25              
26             # Additional metrics will now be reported
27              
28             =head1 DESCRIPTION
29              
30             This module provides no functions or other import symbols. Instead, by simply
31             loading it somewhere in the program, additional metrics are created and
32             reported to L about the operation of L.
33              
34             =cut
35              
36             =head1 METRICS
37              
38             The following metrics are reported:
39              
40             =head2 asyncawait_suspends
41              
42             A counter of the number of times an C has been suspended.
43              
44             =head2 asyncawait_resumes
45              
46             A counter of the number of times an C has been resumed.
47              
48             =head2 asyncawait_current_subs
49              
50             A gauge giving the current count of C instances currently
51             suspended.
52              
53             =head2 asyncawait_states_created
54              
55             A counter of the number of times that C context storage has been
56             created. This may be less than C because storage is
57             reused for multiple C calls within any one function invocation.
58              
59             =head2 asyncawait_states_destroyed
60              
61             A counter giving the number of times that C context storage has
62             been destroyed.
63              
64             =head2 asyncawait_current_states
65              
66             A gauge giving the current count of C context storage instances.
67             This may be less than C because not all of them may
68             be currently suspended.
69              
70             =cut
71              
72             $metrics->make_counter( suspends =>
73             description => "Count of the number of times an async sub has been suspended",
74             );
75              
76             $metrics->make_counter( resumes =>
77             description => "Count of the number of times an async sub has been resumed",
78             );
79              
80             $metrics->make_gauge( current_subs =>
81             description => "Current number of suspended async subs",
82             );
83              
84             $metrics->make_counter( states_created =>
85             description => "Count of the number of times async sub state storage has been created",
86             );
87             $metrics->make_counter( states_destroyed =>
88             description => "Count of the number of times async sub state storage has been destroyed",
89             );
90             $metrics->make_gauge( current_states =>
91             description => "Current number of async sub state storage instances",
92             );
93              
94             =head1 AUTHOR
95              
96             Paul Evans
97              
98             =cut
99              
100             0x55AA;