Rules / Types, classes & roles / basic

Telemetry::Sampler Reference

Telemetry instrument pod

What it is #

Routines #

Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.

method new #

method new(Telemetry::Sampler: @instruments --> Telemetry::Sampler:D)

Returns Telemetry::Sampler:D.

The new method takes a list of instruments. If no instruments are specified, then it will look at the RAKUDO_TELEMETRY_INSTRUMENTS environment variable to find specification of instruments. If that is not available either, then Telemetry::Instrument::Usage and Telemetry::Instrument::ThreadPool will be assumed.

method set-instruments #

method set-instruments(Telemetry::Sampler:D @instruments --> Nil)

Returns Nil.

Allows one to change the instruments on an existing Instrument::Sampler object. Generally only used by calling it on the $*SAMPLER dynamic variable. Takes the same parameters as new, except that specifying no instruments will actually remove all of the instruments, effectively blocking any snap taking.

Examples, run three ways #

Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.

2 no-output

=begin code :preamble<class Telemetry { }>
class Telemetry::Sampler { }
=end code

Not executed: the documentation states no expected output for this example.

use Telemetry;
$*SAMPLER.set-instruments(<Usage ThreadPool>); # default setting

Not executed: the documentation states no expected output for this example.