Расширение:EventLogging
![]() Статус релиза: стабильно |
|
---|---|
Реализация | Служебная страница , База данных , ContentHandler |
Описание | Provides a framework for logging analytics events |
Автор(ы) | Ori.livnehобсуждение |
Последняя версия | continuous updates |
MediaWiki | 1.33+ |
PHP | 5.5+ |
Изменения в БД | Нет |
Лицензия | GNU General Public License 2.0 или позднее |
Скачать | |
|
|
Переведите расширение EventLogging, если оно доступно на translatewiki.net | |
Роль Vagrant | eventlogging |
Проблемы | Открытые задачи · Сообщить об ошибке |
The EventLogging extension makes it possible to collect structured data on how users interact with MediaWiki sites.
Features
- EventLogging supports client-side logging from JavaScript and server-side logging from PHP.
- Logging behavior can be dynamically configured using Extension:EventStreamConfig .
- The events are JSON objects defined by versioned JSONSchemas stored in a schema git repository.
- The extension does not include any back-end code for transporting, parsing, or loading these events. A separate service, EventGate, implements this functionality and deals with inserting events into Kafka. Events are then persisted in downstream datastores (e.g. Hive) via various ingestion pipelines. The details of these components are specific to Wikimedia Foundation's configuration.
EventLogging at Wikimedia
The Wikimedia Foundation uses the EventLogging extension as part of a broader system for collecting, aggregating, storing, and analyzing user data within the limits set out by our privacy policy and data retention guidelines.
This page is about general use of the EventLogging extension. The Wikimedia Foundation uses EventLogging with WMF specific backend components and schema repositories. For Wikimedia specific and maintained documentation, see wikitech:Analytics/Systems/EventLogging and wikitech:Event Platform.
Installation
- Если вы используете Vagrant , установите с помощью
vagrant roles enable eventlogging --provision
- Ручная установка
- Скачайте и распакуйте файл(ы) в папку с названием
EventLogging
в вашей папкеextensions/
. - Добавьте следующие строки в конец файла LocalSettings.php:
wfLoadExtension( 'EventLogging' ); $wgEventLoggingBaseUri = '/beacon/event';
- If you would like to express a conditional dependency on EventLogging in your extension, see this sample code snippet.
- Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
Configuring the schema location
By default, the extension will look for schemas on Meta-Wiki. The relevant default settings are:
# (default) $wgEventLoggingSchemaApiUri = 'https://meta.wikimedia.org/w/api.php';
# (default) $wgEventLoggingDBname = 'metawiki';
To use local schemas, or schemas from the central wiki of your own wikifarm, you need to override these. E.g. to use the Schema
namespace of the local wiki, set
$wgEventLoggingSchemaApiUri = $wgServer . '/w/api.php';
$wgEventLoggingDBname = $wgDBname;
(and ensure the user account that will create the schemas is autoconfirmed).
Logging events using EventLogging
- Extension:EventLogging/Guide - to developing and deploying EventLogging schemas, and more
- Extension:EventLogging/Programming - tips and suggestions for developers writing code to log events
Developing the EventLogging extension
Developer setup
As a developer, you will want to set up and use EventLogging on your development wiki to simulate its use in production.
Using Docker
See MediaWiki-Docker/Configuration recipes/EventLogging
Using mediawiki-vagrant
If you develop using mediawiki-vagrant, everything you need is encapsulated in the eventlogging
role.
To enable it, run:
$ vagrant roles enable eventlogging
$ vagrant provision
For JavaScript development
If working on the JavaScript client, you'll need to install dependencies with npm install
from the folder you're developing in.
Then you can use ./node_modules/grunt/bin/grunt eslint
to lint for example.
The "How to run tests" section below points out how to see JavaScript test results.
How to run tests
There are PHP tests, Python tests, and JavaScript tests.
To run JavaScript tests, visit Special:JavaScriptTest/qunit on your development wiki. (See Manual:JavaScript unit testing .)
To run PHP tests, we use PHPUnit. Make sure it is installed, then:
$ vagrant ssh
vagrant@mediawiki-vagrant:/vagrant/mediawiki/extensions/EventLogging/tests$ php /vagrant/mediawiki/tests/phpunit/phpunit.php EventLoggingExtensionFunctionsTest.php
This extension is included in the following packages and/or wiki farms: |