You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Analytics/Data/ApiAction: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>BryanDavis
(Created page)
 
imported>Meno25
(fix)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== wmf_raw.ApiAction ==
#REDIRECT [[Analytics/Data Lake/Traffic/mediawiki api request]]
The <tt>wmf_raw.ApiAction</tt> table is 'raw' api.php request data. The data is produced by the <code>ApiMain::logRequest()</code> method in MediaWiki to the "ApiAction" debug logging channel. This logging channel is encoded as binary Avro messages and delivered to Kafka. An Oozie job consumes the Avro data from the "mediawiki_ApiAction" channel and stores it in HDFS.
 
=== Avro schema ===
<syntaxhighlight lang="json">
{
  "type": "record",
  "name": "ApiAction",
  "namespace": "org.wikimedia.analytics.schemas",
  "doc": "A single request to the MediaWiki Action API (api.php)",
  "fields": [
    {
      "name": "ts",
      "doc": "The timestamp, in unix time, that the request was made",
      "type": "int",
      "default": 0
    },
    {
      "name": "ip",
      "doc": "The requesting IP address (either ipv4 or ipv6) in string notation",
      "type": "string",
      "default": ""
    },
    {
      "name": "userAgent",
      "doc": "The HTTP User-Agent header prefixed with the Api-user-agent header if present",
      "type": "string",
      "default": ""
    },
    {
      "name": "wiki",
      "doc": "The wiki making this request, such as dewiki or enwiktionary",
      "type": "string",
      "default": ""
    },
    {
      "name": "timeSpentBackend",
      "doc": "Elapsed milliseconds to process request as measured by MediaWiki",
      "type": "int",
      "default": -1
    },
    {
      "name": "hadError",
      "doc": "Were errors encountered when processing this request?",
      "type": "boolean",
      "default": false
    },
    {
      "name": "errorCodes",
      "doc": "List of error codes for any errors encountered",
      "type": {"type": "array", "items": "string"},
      "default": []
    },
    {
      "name": "params",
      "doc": "Request parameters",
      "type": {"type": "map", "values": "string"},
      "default": {}
    }
  ]
}
</syntaxhighlight>

Latest revision as of 11:44, 7 May 2019