diff options
Diffstat (limited to 'includes/libs/Stats/StatsFactory.php')
-rw-r--r-- | includes/libs/Stats/StatsFactory.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/libs/Stats/StatsFactory.php b/includes/libs/Stats/StatsFactory.php index 45573584a816..e75246735136 100644 --- a/includes/libs/Stats/StatsFactory.php +++ b/includes/libs/Stats/StatsFactory.php @@ -99,7 +99,19 @@ class StatsFactory { /** * Adds a label key-value pair to all metrics created by this StatsFactory instance. - * Note that the order in which labels are added is significant. + * Note that the order in which labels are added is significant for StatsD output. + * + * Example: + * ```php + * $statsFactory->withComponent( 'demo' ) + * ->addStaticLabel( 'first', 'foo' ) + * ->addStaticLabel( 'second', 'bar' ) + * ->getCounter( 'testMetric_total' ) + * ->setLabel( 'third', 'baz' ) + * ->increment(); + * ``` + * outputs statsd: "mediawiki.demo.testMetric_total.foo.bar.baz" + * outputs prometheus: "mediawiki_demo_testMetric_total{first='foo',second='bar',third='baz'} * * @param string $key * @param string $value |