class Telemetry::Sampler

Telemetry instrument pod

class Telemetry::Sampler { }

Note: This class is a Rakudo-specific feature and not standard Perl 6.

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

One usually does not create any Telemetry::Sampler objects: when the Telemetry module is loaded, a Telemetry::Sampler object is automatically created in the $*SAMPLER dynamic variable.

An object of the Telemetry::Sampler class knows about which instruments to use when making a snapshot.

method new

method new(Telemetry::Sampler: @instruments --> 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.

Instruments can be specified by either the type object of the instrument class (e.g. Telemetry::Instrument::Usage) or by a string, in which case it will be automatically prefixed with "Telemetry::Instrument::", so "Usage" would be the same as Telemetry::Instrument::Usage.

method set-instruments

method set-instruments(Telemetry::Sampler:D @instruments --> 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.

Type Graph

Type relations for Telemetry::Sampler
perl6-type-graph Telemetry::Sampler Telemetry::Sampler Any Any Telemetry::Sampler->Any Mu Mu Any->Mu

Expand above chart