Jump to content

Metrics Platform/Architecture

From Wikitech

This page provides a detailed overview of the Metrics Platform architecture.

Components

A detailed overview of the architecture of the Metrics Platform.

The Metrics Platform architecture includes the following components:

  • Extension:EventLogging
  • Extension:EventBus
  • Extension:WikimediaEvents
  • Extension:EventStreamConfigs
  • Extension:MetricsPlatform
  • MPIC

We'll give a brief introduction to each of the extensions and MPIC, then we'll discuss how the extensions interact with one another to deliver instrumentation, and then how the MetricsPlatform extension specifically interacts with MPIC.

MediaWiki Extensions

Instrumentation developers use the EventLogging extension directly (or indirectly) to submit analytics events to an event stream in the Data Platform via the event intake service, EventGate.

If the instrumentation is written in JS, then EventLogging will submit the analytics event directly. If the instrumentation is written in PHP, the EventLogging extension will defer to EventBus to submit the analytics event. In both cases, the EventStreamConfigs extension is used to determine the details of the event stream that the analytics event is being submitted to.

EPIC (fka MPIC) - Experiment Platform Instrument Configurator

Instrumentation owners use EPIC to configure their instruments pre- and post-deployment. Instrumentation configuration is editable via a web app and served to Metrics Platform Clients via a RESTful API.

The EPIC application provides the following endpoints:

https://mpic.wikimedia.org/api/v1/instruments

https://mpic.wikimedia.org/api/v1/experiments

Limited to authorized end users, the EPIC application can be accessed at https://mpic.wikimedia.org/

Extension:MetricsPlatform and EPIC

Now that the components have been introduced, we can discuss how the MetricsPlatform extension and EPIC work together to deliver configuration to instruments running on the server and on the client.

The MetricsPlatform extension fetches instrument configuration from the EPIC RESTful API and dynamically creates event stream configurations for the EventStreamConfig extension to process.

Delivering instrumentation and its configuration is secondary to delivering content to the user quickly. As such, the MetricsPlatform extension caches the response from the EPIC RESTful API in the WAN Cache. The extension will attempt to fetch the cached response first before making a request to the EPIC RESTful API. If an error occurs or the request takes more than 250 ms to complete, then a cached response is returned. If there is no cached response, then an empty response is returned, which disables all EPIC-managed instrumentation.