Extension:EventLogging

This page is a translated version of the page Extension:EventLogging and the translation is 13% complete.
Other languages:
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced-invert.svg
EventLogging
リリースの状態: 安定
実装 特別ページ , データベース , ContentHandler
説明 Provides a framework for logging analytics events
作者 Ori.livnehトーク
最新バージョン 継続的な更新
MediaWiki 1.33+
PHP 5.5+
データベースの変更 いいえ
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
  • $wgEventLoggingStreamNames
  • $wgEventLoggingSchemaApiUri
  • $wgEventLoggingServiceUri
  • $wgEventLoggingQueueLingerSeconds
  • $wgEventLoggingBaseUri
  • $wgEventLoggingSchemas
  • $wgEventLoggingDBname
translatewiki.net で翻訳を利用できる場合は、EventLogging 拡張機能の翻訳にご協力ください

使用状況とバージョン マトリクスを確認してください。

Vagrant role eventlogging
問題点 未解決のタスク · バグを報告

The EventLogging extension makes it possible to collect structured data on how users interact with MediaWiki sites.

特徴

  • 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 でインストールしてください
手動インストール
  • ダウンロードして、ファイルを extensions/ フォルダー内の EventLogging という名前のディレクトリ内に配置します。
  • 以下のコードを 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

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

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. (Manual:JavaScript 単体テスト を参照してください。)

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