Extension: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
미디어위키 확장 내려받기 지면에서 해당하는 버전을 다운로드하고 위키의 extensions 디렉토리에 EventLogging에 푸십시오.
또는 개발자와 코드 기여자는 대신 다음을 사용하여 Git에서 확장 프로그램을 설치해야 합니다.
cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging
미디어위키 설정 LocalSettings.php에 다음을 추가하십시오:
wfLoadExtension( 'EventLogging' );
$wgEventLoggingBaseUri = '/beacon/event';
$wgEventLoggingServiceUri = '/beacon/intake-analytics';
$wgEventLoggingStreamNames = false;
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 npm test to run ESLint for example.
The "How to run tests" section below points out how to see JavaScript test results.
When adding the parameter trackdebug=true to the URL, the console in the browser's devtools will show the event logging being triggered.
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$ composer phpunit:entrypoint -- extensions/EventLogging/testsEventLoggingExtensionFunctionsTest.php
이 확장은 하나 이상의 위키미디어 프로젝트 또는 다움위키에서 사용되고 있습니다. 이것은 아마도 확장이 안정적이고 높은-트래픽 웹 사이트에서 사용되기에 충분히 잘 작동한다는 것을 의미합니다. 위키미디어의 CommonSettings.php 및 InitialiseSettings.php 구성 파일에서 이 확장의 이름을 찾아 설치 위치를 확인하십시오. 특정 위키에 설치된 확장의 전체 목록은 위키의 Special:Version 페이지에서 볼 수 있습니다. |