|
MediaWiki 1.43.1
|
StatsFactory Implementation. More...
Public Member Functions | |
| __construct (StatsCache $cache, EmitterInterface $emitter, LoggerInterface $logger, string $component='') | |
| StatsFactory builds, configures, and caches Metrics. | |
| flush () | |
| Send all buffered metrics to the target and destroy the cache. | |
| getCounter (string $name) | |
| Makes a new CounterMetric or fetches one from cache. | |
| getGauge (string $name) | |
| Makes a new GaugeMetric or fetches one from cache. | |
| getTiming (string $name) | |
| Makes a new TimingMetric or fetches one from cache. | |
| withComponent (string $component) | |
| Returns a new StatsFactory instance prefixed by component. | |
| withStatsdDataFactory (?IBufferingStatsdDataFactory $statsdDataFactory) | |
Static Public Member Functions | |
| static | newNull () |
| Returns an instance of StatsFactory as a NULL value object as a default for consumer code to fall back to. | |
StatsFactory Implementation.
This is the primary interface for validating metrics definitions caching defined metrics, and returning metric instances from cache if previously defined.
Definition at line 47 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::__construct | ( | StatsCache | $cache, |
| EmitterInterface | $emitter, | ||
| LoggerInterface | $logger, | ||
| string | $component = '' ) |
StatsFactory builds, configures, and caches Metrics.
| StatsCache | $cache | |
| EmitterInterface | $emitter | |
| LoggerInterface | $logger | |
| string | $component |
Definition at line 72 of file StatsFactory.php.
References Wikimedia\Stats\StatsUtils\normalizeString().
| Wikimedia\Stats\StatsFactory::flush | ( | ) |
Send all buffered metrics to the target and destroy the cache.
Definition at line 139 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::getCounter | ( | string | $name | ) |
Makes a new CounterMetric or fetches one from cache.
If a collision occurs, returns a NullMetric to suppress exceptions.
| string | $name |
Definition at line 108 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::getGauge | ( | string | $name | ) |
Makes a new GaugeMetric or fetches one from cache.
If a collision occurs, returns a NullMetric to suppress exceptions.
| string | $name |
Definition at line 120 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::getTiming | ( | string | $name | ) |
Makes a new TimingMetric or fetches one from cache.
If a collision occurs, returns a NullMetric to suppress exceptions.
| string | $name |
Definition at line 132 of file StatsFactory.php.
|
static |
Returns an instance of StatsFactory as a NULL value object as a default for consumer code to fall back to.
This can also be used in tests environment where we don't need the full UDP emitter object.
Definition at line 195 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::withComponent | ( | string | $component | ) |
Returns a new StatsFactory instance prefixed by component.
| string | $component |
Definition at line 90 of file StatsFactory.php.
| Wikimedia\Stats\StatsFactory::withStatsdDataFactory | ( | ?IBufferingStatsdDataFactory | $statsdDataFactory | ) |
Definition at line 95 of file StatsFactory.php.