Wikimedia Product/Wikimedia Product Infrastructure team/Action API request analytics

Action API request analytics will be reports and/or dashboards to track usage of the MediaWiki Action API for Wikimedia production websites. This tracking is intended to be similar to the Pageviews tracking that is currently done by the Analytics team for articles in the main namespace.

Desired outcome
Data sets providing:
 * Number of user agents coming from Labs or third party services, on a monthly basis
 * Volume of API requests coming from Labs or third party services, on a monthly basis
 * Ranking of user agents coming from Labs or third party services with a highest activity, on a monthly basis
 * Ranking of most requested actions/parameters, on a monthly basis

Data acquisition
Raw Action API requests will be tracked using MediaWiki structured logging, Kafka and Hive.


 * 1) Log events will be emitted by MediaWiki for each Action API request using a structured logging context that contains the data needed to populate the Hive tables.
 * 2) Monolog will be configured to route these log events to a Kafka topic.
 * 3) Camus will process events from the Kafka topic and load them into a raw data table in Hive.
 * Oozie will run a (daily?) Hive script to summarize the raw data table into various aggregate tables designed for specific reporting needs via ETL processing.
 * 1) Oozie will run a Hive script to discard the raw request data after processing to reduce the risk of leaking sensitive data due to a network break or malicious actor.
 * 2) Oozie will run Hive script to generate monthly summary data from the aggregate tables for export to interested parties.

(action, param, value) tuples
We do not want to try and count all of the distinct (action, param, value) tuples that are seen in the aggregation tables. For some params we will also want to expand an embedded list of values given as a single parameter into a list of (action, param, value) tuples that should be counted individually.

For the initial ETL process we will count these tuples:
 * action=query
 * param=prop, value from exploding the '|' delimited value
 * param=list, value from exploding the '|' delimited value
 * param=meta, value from exploding the '|' delimited value
 * param=generator
 * action=flow
 * param=submodule

Monthly reports
Number of user agents coming from Labs or third party services, on a monthly basis

Volume of API requests coming from Labs or third party services, on a monthly basis

Ranking of user agents coming from Labs or third party services with a highest activity, on a monthly basis

Ranking of most requested actions/parameters, on a monthly basis