Commit graph

5 commits

Author SHA1 Message Date
Cole White
6772d2c969 stats: remove static labels feature
The feature was included presuming the PerDbNameStatsdDataFactory
was a required use case.

Static labels supported a use case that we no longer consider good
practice and was likely bug-ridden.

For more information, see linked bug.

Bug: T359436
Change-Id: I60c497727fdae493c3bb18de3bd1a4db338132cc
2024-04-04 14:39:41 +00:00
Derick Alangi
5fb8a5a614
Stats: Introduce factory method to create NULL stats factory
This patch introduced a new method `newNull()` which will return an
instance of a Null StatsFactory for code that wants to fallback to a
valid (light-weight compatible) default.

NOTE: Updated tests to use the new code and as a TODO, ObjectCache will
need this in a follow-up patch.

Bug: T356251
Change-Id: I9efcce04c127af8633eca792e63b1f0dad6696a0
2024-02-08 20:45:34 +03:00
Cole White
bb864c4885 Stats: make component optional
* Add withComponent() to configure StatsFactory components.
 * Throw exception on setting static labels without component.
 * Clean up ServiceWiring and MediaWikiServices.
 * Rename withLabel to setLabel.
 * Rename withSampleRate to setSampleRate.
 * Rename withStaticLabel to addStaticLabel.
 * Update tests.

Bug: T240685
Change-Id: I6c99a532431f00bd140f44cb2d5eba2a9d83ca57
2023-09-04 18:00:49 +01:00
Cole White
b3d20f8873 Stats: simplify metrics configuration, enforce builder pattern
BREAKING INTERFACE CHANGE

 * getMetric() (and all subtypes) now only require a $name.
 * Labels are added dynamically and order enforced by BaseMetric labelKeys.
 * Metric component is now defined in the service instance.
 * Remove InvalidLabelsException.
 * Make addLabelKey() private.
 * Removed unused functions.
 * NullMetric to return $this - support builder pattern.
 * Update tests.

Bug: T240685
Change-Id: Id8cb62ec74907cb54dc39b6a228a230eed0c957d
2023-03-02 23:09:41 +00:00
Cole White
fa92ab43e9 Metrics: rename Metrics lib to Stats
Bug: T240685
Change-Id: Ie43d894b6b4030a88e397495d40886ccb6e69835
2023-02-24 23:01:32 +00:00
Renamed from tests/phpunit/unit/includes/libs/Metrics/MetricsFactoryTest.php (Browse further)