1Metrics::Any::Adapter(3U)ser Contributed Perl DocumentatiMoentrics::Any::Adapter(3)
2
3
4

NAME

6       "Metrics::Any::Adapter" - set the "Metrics::Any" adapter for the
7       program
8

SYNOPSIS

10       In a program or top-level program-like module:
11
12          use Metrics::Any::Adapter 'Prometheus';
13

DESCRIPTION

15       The "use" statement which loads this module sets the adapter module for
16       Metrics::Any to report metrics generated by an modules the program
17       uses.
18
19       The first value passed should be a string giving the name of an adapter
20       module, which will be expected under the
21       "Metrics::Any::Adapter::"-prefix.  This module will be loaded and set
22       as the adapter to use. Any additional arguments will be passed to the
23       constructor of the adapter instance.
24
25          use Metrics::Any::Adapter Custom => "another arg";
26
27          # implies
28          $adapter = Metrics::Any::Adapter::Custom->new( "another arg" );
29

ENVIRONMENT

31   METRICS_ANY_ADAPTER
32       Since version 0.04.
33
34       Sets the default adapter type to use if the program has not otherwise
35       requested one.
36
37       Normally this is set to "Null", which loads
38       Metrics::Any::Adapter::Null.  By overriding this to a different value,
39       a default adapter can be loaded without modifying the program. This may
40       be useful for example, when running unit tests:
41
42          $ METRICS_ANY_ADAPTER=Stderr ./Build test
43
44       Additional arguments can be specified after a colon, separated by
45       commas or equals signs.
46
47          $ METRICS_ANY_ADAPTER=File:path=metrics.log ./program.pl
48
49       Note that if a program requests a specific adapter that will override
50       this variable.
51
52       A limited attempt is made at supporting nested arguments wrapped in
53       square brackets, to allow basic operation of the
54       Metrics::Any::Adapter::Tee adapter via this variable to itself pass
55       arguments into child adapters:
56
57          $ METRICS_ANY_ADAPTER=Tee:Prometheus,[File:path=metrics.log] perl ...
58
59       This should be considered a best-effort scenario useful for short-term
60       testing and debugging. For more complex requirements in your script or
61       program, it is better to use the import arguments directly as then any
62       perl data structures can be passed around.
63

AUTHOR

65       Paul Evans <leonerd@leonerd.org.uk>
66
67
68
69perl v5.32.0                      2020-07-28          Metrics::Any::Adapter(3)
Impressum