Skip to content

Commit b5a8a43

Browse files
committed
First stab at documenting Telemetry::Sampler
1 parent 24fe425 commit b5a8a43

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

doc/Type/Telemetry/Sampler.pod6

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
=begin pod
2+
3+
=TITLE class Telemetry::Sampler
4+
5+
=SUBTITLE Telemetry Instrument Pod
6+
7+
=begin code :preamble<class Telemetry { }>
8+
class Telemetry::Sampler { }
9+
=end code
10+
11+
B<Note: > This class is a Rakudo-specific feature and not standard Perl 6.
12+
13+
=begin code
14+
use Telemetry;
15+
$*SAMPLER.set-instruments(<Usage ThreadPool>); # default setting
16+
=end code
17+
18+
One usually does not create any C<Telemetry::Sampler> objects: when the
19+
L<Telemetry|/type/Telemetry> module is loaded, a C<Telemetry::Sampler> object
20+
is automatically created in the C<$*SAMPLER> dynamic variable.
21+
22+
An object of the C<Telemetry::Sampler> class knows about which instruments
23+
to use when making a snapshot.
24+
25+
=head2 method new
26+
27+
method new(Telemetry::Sampler: @instruments --> Telemetry::Sampler:D)
28+
29+
The C<new> method takes a list of instruments. If no instruments are specified,
30+
then it will look at the C<RAKUDO_TELEMETRY_INSTRUMENTS> environment variable
31+
to find specification of instruments. If that is not available either, then
32+
L<Thread::Instrument::Usage|/type/Thread::Instrument::Usage> and
33+
L<Thread::Instrument::ThreadPool|/type/Thread::Instrument::ThreadPool> will be
34+
assumed.
35+
36+
Instruments can be specified by either the type object of the instrument class
37+
(e.g. C<Telemetry::Instrument::Usage>) or by a string, in which case it will
38+
be automatically prefixed with "Telemetry::Instrument::", so "Usage" would be
39+
the same as C<Telemetry::Instrument::Usage>.
40+
41+
=head2 method set-instruments
42+
43+
method set-instruments(Telemetry::Sampler:D @instruments --> self)
44+
45+
Allows one to change the instruments on an existing C<Instrument::Sampler>
46+
object. Generally only used by calling it on the C<$*SAMPLER> dynamic variable.
47+
Takes the same parameters as L<new>, except that specifying B<no> instruments
48+
will actually remove all of the instruments, effectively blocking any snap taking.
49+
50+
=end pod
51+
52+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)