jenkins-bot has submitted this change and it was merged.
Change subject: Collect timing information for getting a pooled curl handle
......................................................................
Collect timing information for getting a pooled curl handle
Bug: T130219
Change-Id: I398b6e622336199d5d6d7c43b0d6a98b02980afd
---
M includes/Elastica/PooledHttp.php
1 file changed, 19 insertions(+), 0 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
DCausse: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/Elastica/PooledHttp.php b/includes/Elastica/PooledHttp.php
index 766e611..8ffd02c 100644
--- a/includes/Elastica/PooledHttp.php
+++ b/includes/Elastica/PooledHttp.php
@@ -4,6 +4,7 @@
use Elastica\Transport\Http;
use MediaWiki\Logger\LoggerFactory;
+use RequestContext;
/**
* Implements cross-request connection pooling via hhvm's built in
@@ -66,7 +67,10 @@
// up to curl.namedPools.$pool.connGetTimeout ms,
defaulting
// to 5000. If the timeout is reached hhvm will raise a
fatal
// error.
+ $start = microtime( true );
$ch = curl_init_pooled( $pool );
+ $this->reportTiming( microtime( true ) - $start );
+
if ( $ch === null ) {
LoggerFactory::getInstance( 'CirrusSearch'
)->warning(
"Elastic connection pool cannot init:
Unknown pool {pool}. Did you configure curl.namedPools?",
@@ -81,4 +85,19 @@
return $ch;
}
+
+ /**
+ * @param float $tookS The number of seconds taken to get the pooled
handle
+ */
+ protected function reportTiming( $tookS ) {
+ // Should this in some way collect stats about requests that
take longer than normal,
+ // or just allow standard p95 or p99 to collect them? With
thousands of requests per
+ // second i wonder if a couple servers having issues with their
pools will by lost in
+ // the noise. Another option could be recording per-server
stats and including gethostname()
+ // in the key?
+ RequestContext::getMain()->getStats()->timing(
+ 'CirrusSearch.connectionPool.initMs',
+ intval( 1000 * $tookS )
+ );
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/279064
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I398b6e622336199d5d6d7c43b0d6a98b02980afd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits