MediaWiki-Docker/Configuration recipes/EventLogging

Minimal setup
If you only need to satisfy a dependency on EventLogging for another extension, and/or only need to inspect or debug events from the client-side in a browser, then the Event Platform extensions and their configuration are not required. Instead the standard dependency-free installation documented on Extension:EventLogging will suffice.


 * 1) clone EventLogging into the extensions directory:


 * 1) Add the below to.
 * 2) No step three!

Event Platform
Follow the below steps to create a more complete Event Platform environment, akin to WMF production. You will be able to log events to a containerized EventGate instance (herein "EventGate") from both server-side and client-side MediaWiki code. EventGate will validate events against schemas fetched from https://schema.wikimedia.org.

Extensions
You need to install these extensions:


 * EventBus
 * EventStreamConfig
 * EventLogging
 * WikimediaEvents (not strictly required, it adds Wikimedia-specific instrumentations).

i.e.

Running
You can test the above by running this in your browser's JavaScript console:

Event Platform with Local Schema Repositories
Iterating on the above, setting up and configuring your MediaWiki-Docker instance as below will reconfigure EventGate to validate events against schemas from clones of the schema repositories.

Repositories
You need to clone these repositories into the  directory:


 * schemas/event/primary
 * schemas/event/secondary

e.g.

Metrics Platform
The Metrics Platform Clients are Event Platform clients. They all use the same schema, the  schema, when submitting events. The clients are configured via stream configuration on a per-stream basis.

Configuring your MediaWiki-Docker instance as below will configure the PHP and JS Metrics Platform Clients to log all events to a single stream, the  stream.

Navigate to http://localhost:8080/wiki/Main_Page and run this in the JavaScript console of your browser's developer tools: You should see your event in the  log.

Repository (for server-side logging)
To enable server-side logging, you need to clone this repository into the  directory:


 * mediawiki/libs/metrics-platform

Legacy EventLogging
In the legacy EventLogging pipeline, schemas were defined and documented on metawiki. Even though the legacy EventLogging pipeline is being migrated away from, you might still be called on to modify an instrument that uses one such schema.

Setting up and configuring your MediaWiki-Docker instance as below will allow you to log events to a containerized legacy EventLogging event intake service.

Unit testing
If you need to run PHPUnit tests, any test which incidentally causes event logging to occur will cause PHPUnit to error immediately with  In the example   above, server-side event submission is disabled whilst the PHPUnit tests are running. If you actually need to test the sending of events... good luck, please update this recipe if you work it out.