Extension:NavigationTiming
NavigationTiming Release status: stable |
|
---|---|
Implementation | Ajax |
Description | Logs perceived latency measurements from client-side |
Author(s) | Patrick Reilly, Ori Livneh, Asher Feldman, Timo Tijhof, Ian Marlier |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | >= 1.42 |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | README |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the NavigationTiming extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The NavigationTiming extension measures perceived latency in browsers. The extension is named after the W3C Navigation Timing API in web browsers, but today collects metrics from several different browser APIs.
FAQ
Scope
The extension collects anonimised information from a sample of page views. The collection uses JavaScript and thus is limited to pageviews that:
- are from a modern browser, as defined by the Grade A capability check (90%+ of traffic).
- have the Navigation Timing API, (98% of browser traffic in 2022, 95% in Nov 2017[1])
- reach the "page loaded" event (99%+ of page loads).
- are in the random sample (configurable).
How is the information used?
Engineers at Wikimedia Foundation intend to use this data to assess the impact (positive and negative) of changes to application code and server configuration. Thus guiding on-going work on site performance.
Dependencies
Installation
- <translate> [[<tvar name=2>Special:ExtensionDistributor/NavigationTiming</tvar>|Download]] and move the extracted <tvar name=name>
NavigationTiming
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/NavigationTiming - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'NavigationTiming' ); $wgNavigationTimingSamplingFactor = 1; // 100% (1 of every 1)
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Oversampling
Oversampling allows us to selectively sample a larger portion of the traffic coming from a particular geography, or with a specific User Agent string in the browser.
Use cases for this include:
- obtain detailed observations of a change in performance, based data center location
- evaluate a change in performance due to browser upgrades (e.g. upstream Firefox 57 released an internal change intended to improve performance).
Oversampling is configured using the $wgNavigationTimingOversampleFactor
variable. This variable is an associative array, and the keys that are checked are "geo" and "userAgent".
If the user's country code is included in the "geo" array, then a sample is taken with frequency 1/samplerate. If the user's browser has a User Agent string that matches a key in the userAgent array, then a sample is taken with frequency 1/samplerate. No more than one oversample is taken for a given pageload.
If the page load is oversampled, the emitted event will include these properties:
isOversample: true
oversampleReason: string
, whose contents are a JSON array of reasons that the oversample happened. These will be of the form "geo:XX" (where XX is the matching country code), or "ua:ABCDEF" (where ABCDEF is the matching browser's User Agent string)
Further reading
About the data we collect:
- Explainer of navtiming metrics, Wikitech.
- Wikimedia Grafana: Navigation Timing dashboard, grafana.wikimedia.org
- Performance infrastructure, Wikitech.
About the Navigation Timing API in web browsers:
- Navigation Timing API, specification from the W3C.
- Annotated Timing object: simplified descriptions of the measurements.
- Measuring Page Load Speed with Navigation Timing, HTML5 Rocks.
Code stewardship
- <translate> Maintained by <tvar name=1>Unknown or Unassigned[Maintainers page]</tvar>.</translate>
- <translate> Issue tracker: [<tvar name=url>https://phabricator.wikimedia.org/tag/mediawiki-extensions-navigationtiming/</tvar> Phabricator <tvar name=phab>MediaWiki-extensions-NavigationTiming</tvar>] ([<tvar name=url2>https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=mediawiki-extensions-navigationtiming</tvar> Report an issue])</translate>
Footnotes
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |