txt: ## sampler.md
  class Telemetry::Sampler
  
  Telemetry instrument pod
  
  ```raku
  class Telemetry::Sampler { }
  
  ```
  
  **Note:**  This class is a Rakudo-specific feature and not standard Raku.
  
  ```raku
  use Telemetry;
  $*SAMPLER.set-instruments(<Usage ThreadPool>); # default setting
  
  ```
  
  One usually does not create any `Telemetry::Sampler` objects: when the [`Telemetry`](/type/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](#class_Telemetry::Sampler "go to top of document")[§](#method_new "direct link")
  
  ```raku
  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`](/type/Telemetry/Instrument/Usage) and [`Telemetry::Instrument::ThreadPool`](/type/Telemetry/Instrument/ThreadPool) will be assumed.
  
  Instruments can be specified by either the type object of the instrument class (e.g. [`Telemetry::Instrument::Usage`](/type/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`](/type/Telemetry/Instrument/Usage).
  
  ## [method set-instruments](#class_Telemetry::Sampler "go to top of document")[§](#method_set-instruments "direct link")
  
  ```raku
  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](/routine/new), except that specifying **no** instruments will actually remove all of the instruments, effectively blocking any snap taking.
  