Background
See the parent task (T292803: IP Info: Explore Instrumentation) for detail about both why we're instrumenting IP Info and what we intend to instrument.
Before we can send events via EventLogging and have them ingested by the EventGate event intake servers, however, we need to:
- Create the JSON Schema schema used to validate the events that our instrument sends and add it to the https://gerrit.wikimedia.org/r/admin/repos/schemas/event/secondary repository
- Update the MediaWiki extension's definition to include a stream name that we will publish our events on that will be validated by that schema
- Profit
AC
- The analytics.mediawiki.ipinfo_interaction JSON Schema is defined in the https://gerrit.wikimedia.org/r/admin/repos/schemas/event/secondary repository
- By convention, it'll live in jsonschema/analytics/mediawiki/ipinfo_interaction
- It will have the following fields defined:
- event_action (string)
- "open_popup"
- "open_infobox"
- "expand"
- "collapse"
- "init_disclaimer"
- "accept_disclaimer"
- "close_disclaimer"
- "enable_ipinfo"
- "disable_ipinfo"
- "check_iagree"
- "uncheck_iagree"
- "copy"
- "click_help"
- event_context (string)
- "page"
- "infobox"
- "popup"
- "ip_address"
- event_source (string)
- "action_history"
- "special_log"
- "special_recentchanges"
- "special_contributions"
- "special_preferences"
- user_editBucket (string|null)"
- "0 edits"
- "1-4 edits"
- "5-99 edits"
- "100-999 edits"
- "1000+ edits"
- user_groups (string|null)
- A "|"-separated list of the groups that the user belongs to
- event_action (string)
- When I click the ? button next to an IP address, the following event should be logged:
{ "$schema": "analytics.mediawiki.ipinfo_interaction/1.0.0", event_action: "open_popup", event_context: "page", event_source: "...", // Depending on the action/page that I'm on, i.e. one of "action_history", "special_log", "special_recentchanges" user_editBucket: "...", user_groups: [ "users", ... ] }
Notes
- mw.config.get( 'wgUserEditCountBucket' );, which is set by the EventLogging extension, should be used to populate user_editBucket
- See the current.yaml files in the subdirectories in https://gerrit.wikimedia.org/r/plugins/gitiles/schemas/event/secondary/+/refs/heads/master/jsonschema/analytics/mediawiki for numerous examples of JSON Schema schemas that are used in production
- wt:Event Platform/Instrumentation How To is a step-by-step guide to creating a creating a schema and validating an event with it
- https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/EventLogging is a step-by-step guide to setting up your local development environment