Provide a prefixed StatsFactory in parsoid config
Change-Id: Ic3fc353b030a292952091813c9847cd697b25444
This commit is contained in:
parent
fec9daae4e
commit
473e8c32bf
1 changed files with 11 additions and 4 deletions
|
|
@ -252,6 +252,15 @@ class SiteConfig extends ISiteConfig {
|
|||
return $prefixedMetrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a prefixed StatsFactory for parsoid stats
|
||||
* @return StatsFactory|null
|
||||
*/
|
||||
public function prefixedStatsFactory(): ?StatsFactory {
|
||||
$component = $this->getStatsPrefix( true );
|
||||
return $this->statsFactory->withComponent( $component );
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a timing metric
|
||||
* @param string $name
|
||||
|
|
@ -260,8 +269,7 @@ class SiteConfig extends ISiteConfig {
|
|||
* @return void
|
||||
*/
|
||||
public function observeTiming( string $name, float $value, array $labels ) {
|
||||
$component = $this->getStatsPrefix( true );
|
||||
$metric = $this->statsFactory->withComponent( $component )->getTiming( $name );
|
||||
$metric = $this->prefixedStatsFactory()->getTiming( $name );
|
||||
foreach ( $labels as $labelKey => $labelValue ) {
|
||||
$metric->setLabel( $labelKey, $labelValue );
|
||||
}
|
||||
|
|
@ -276,8 +284,7 @@ class SiteConfig extends ISiteConfig {
|
|||
* @return void
|
||||
*/
|
||||
public function incrementCounter( string $name, array $labels, float $amount = 1 ) {
|
||||
$component = $this->getStatsPrefix( true );
|
||||
$metric = $this->statsFactory->withComponent( $component )->getCounter( $name );
|
||||
$metric = $this->prefixedStatsFactory()->getCounter( $name );
|
||||
foreach ( $labels as $labelKey => $labelValue ) {
|
||||
$metric->setLabel( $labelKey, $labelValue );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue