EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260177

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, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/77/260177/1

diff --git a/includes/ElasticsearchIntermediary.php 
b/includes/ElasticsearchIntermediary.php
index 12992e6..c98b523 100644
--- a/includes/ElasticsearchIntermediary.php
+++ b/includes/ElasticsearchIntermediary.php
@@ -176,8 +176,19 @@
                                        $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->getEntriesByType( 'requestStart' );
+               $endMark  = $timing->getEntriesByType( 'requestShutdown' );
+               $tookMs = $endMark['startTime'] - $startMark['startTime'];
 
                $requestSet = array(
                        'ts' => time(),
@@ -187,7 +198,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' => $tookMs,
+                               // 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: newchange
Gerrit-Change-Id: Ic562e5ad3533fe3610a70f8e96ad192c9f395287
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to