jenkins-bot has submitted this change and it was merged.
Change subject: Add some request set payload values
......................................................................
Add some request set payload values
This adds the accept language, the user perceived execution time,
and information about if langdetect triggered to the request set
payload.
Change-Id: Ic562e5ad3533fe3610a70f8e96ad192c9f395287
---
M includes/ElasticsearchIntermediary.php
1 file changed, 27 insertions(+), 1 deletion(-)
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/ElasticsearchIntermediary.php
b/includes/ElasticsearchIntermediary.php
index 12992e6..e4b65af 100644
--- a/includes/ElasticsearchIntermediary.php
+++ b/includes/ElasticsearchIntermediary.php
@@ -176,7 +176,28 @@
$request['namespaces'][] = (int) $id;
}
}
+ if ( !empty( $context['langdetect' ] ) ) {
+ $request['payload']['langdetect'] =
$context['langdetect'];
+ }
$requests[] = $request;
+ }
+
+ // Note that this is only accurate for hhvm and php-fpm
+ // since they close the request to the user before running
+ // deferred updates.
+ $timing = \RequestContext::getMain()->getTiming();
+ $startMark = $timing->getEntryByName( 'requestStart' );
+ $endMark = $timing->getEntryByName( 'requestShutdown' );
+ if ( $startMark && $endMark ) {
+ // should always work, but Timing can return null so
+ // fallbacks are provided.
+ $tookS = $endMark['startTime'] -
$startMark['startTime'];
+ } elseif( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ) {
+ // php >= 5.4
+ $tookS = microtime( true ) -
$_SERVER['REQUEST_TIME_FLOAT'];
+ } else {
+ // php 5.3
+ $tookS = microtime( true ) - $_SERVER['REQUEST_TIME'];
}
$requestSet = array(
@@ -187,7 +208,12 @@
'ip' => $wgRequest->getIP() ?: '',
'userAgent' => $wgRequest->getHeader( 'User-Agent') ?:
'',
'backendUserTests' =>
UserTesting::getInstance()->getActiveTestNamesWithBucket(),
- 'payload' => array(),
+ 'payload' => array(
+ // may want to promote this to a top level var
at some point
+ 'tookMs' => intval( 1000 * $tookS ),
+ // useful while we are testing accept-lang
based interwiki
+ 'acceptLang' => $wgRequest->getHeader(
'Accept-Language' ) ?: '',
+ ),
'requests' => $requests,
);
--
To view, visit https://gerrit.wikimedia.org/r/260177
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic562e5ad3533fe3610a70f8e96ad192c9f395287
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: 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