-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Migrate MediaWiki.wikibase.query_contexts.* to statslib"
- Loading branch information
Showing
8 changed files
with
43 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
namespace Wikibase\Lib\Store\Sql\Terms\Util; | ||
|
||
use MediaWiki\MediaWikiServices; | ||
use Wikibase\Lib\WikibaseSettings; | ||
|
||
/** | ||
* Trait for adding stats metrics on queries from repo/client | ||
* | ||
* @license GPL-2.0-or-later | ||
*/ | ||
trait StatsMonitoring { | ||
public function incrementForQuery( string $queryType ): void { | ||
MediaWikiServices::getInstance()->getStatsFactory() | ||
->getCounter( 'wikibase_repo_term_store_total' ) | ||
->setLabel( 'query_type', $queryType ) | ||
->copyToStatsdAt( "wikibase.repo.term_store.$queryType" ) | ||
->increment(); | ||
if ( WikibaseSettings::isRepoEnabled() ) { | ||
$queryContext = 'repo'; | ||
} else { | ||
$queryContext = 'client'; | ||
} | ||
MediaWikiServices::getInstance()->getStatsFactory() | ||
->getCounter( 'wikibase_query_contexts_term_store_total' ) | ||
->setLabel( 'query_context', $queryContext ) | ||
->setLabel( 'query_type', $queryType ) | ||
->copyToStatsdAt( "wikibase.query_contexts.$queryContext.term_store.$queryType" ) | ||
->increment(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.