1Metrics::Any::Adapter::UFsielre(C3opnmt)ributed Perl DocMuemternitcast:i:oAnny::Adapter::File(3pm)
2
3
4
6 "Metrics::Any::Adapter::File" - write metrics to a file
7
9 use Metrics::Any::Adapter 'File', path => "metrics.log";
10
12 This Metrics::Any adapter type writes observations of metric values
13 into a file. This may be helpful while debugging or otherwise testing
14 code that reports metrics.
15
16 For example, by setting the "METRICS_ANY_ADAPTER" environment variable
17 to configure the adapter, a metric log will be written as a side-effect
18 of running a unit test:
19
20 $ METRICS_ANY_ADAPTER=File:path=metrics.log perl -Mblib t/01test.t
21
22 The generated file can then be inspected to see what metric values were
23 reported while the program was running.
24
25 In particular, specifying the file /dev/null allows the full metrics
26 generation path to be tested with the code under test seeing a "real"
27 adapter even though the output goes nowhere.
28
29 $ METRICS_ANY_ADAPTER=File:path=/dev/null ./Build test
30
31 Distribution and timing metrics are tracked with a running total and
32 count of observations.
33
34 This adapter type does not support batch mode reporting.
35
37 The following additional arguments are recognised
38
39 path
40 The path to the file to write to.
41
43 Paul Evans <leonerd@leonerd.org.uk>
44
45
46
47perl v5.38.0 2023-07-24 Metrics::Any::Adapter::File(3pm)