Page MenuHomePhabricator

Instrumentation of new SX entrypoints
Open, HighPublic

Description

Some new entrypoints have been deployed during the recent months and some are still being developed (T286641). In order to track how effective these new entrypoints are, we need to instrument them.

This task is intended to both support this instrumentation within the SX application and keep all the related information in a single place.

Event Timeline

The event names for each entrypoint should be the following:

  1. Entrypoint inside language selector (mflanguagesearcher): content_language_selector
  2. Entrypoint inside recently translated article (mfrecenttranslation) - Not yet completely supported: recent_translation
  3. Entrypoint inside recently edited article (mfrecentedit) - Not yet deployed: recent_edit
  4. Entrypoint inside recently edited article (mffrequentlanguages) - Not yet deployed: frequent_languages

Change 760890 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Instrumentation support for all entrypoints

https://gerrit.wikimedia.org/r/760890

Change 760890 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Instrumentation support for all entrypoints

https://gerrit.wikimedia.org/r/760890

I see validation errors from eventlogging

I am using mw cli and it has eventlogging support.

eventlogging_1                         | {
eventlogging_1                         |   "$schema": "/analytics/mediawiki/content_translation_event/1.0.0",
eventlogging_1                         |   "translation_type": "section",
eventlogging_1                         |   "wiki_db": "es",
eventlogging_1                         |   "access_method": "desktop",
eventlogging_1                         |   "user_name": "Admin",
eventlogging_1                         |   "user_is_anonymous": false,
eventlogging_1                         |   "content_translation_session_id": "cx_sx_c18ed0109578987ac734_desktop_es",
eventlogging_1                         |   "event_type": "dashboard_open",
eventlogging_1                         |   "event_source": "direct",
eventlogging_1                         |   "content_translation_session_position": 0,
eventlogging_1                         |   "user_global_edit_count": 152,
eventlogging_1                         |   "user_global_edit_count_bucket": "100-999 edits",
eventlogging_1                         |   "meta": {
eventlogging_1                         |     "stream": "mediawiki.content_translation_event",
eventlogging_1                         |     "domain": "es.mediawiki.mwdd.localhost",
eventlogging_1                         |     "id": "eb1853c9-3930-4de5-9091-da604920d88f",
eventlogging_1                         |     "dt": "2022-02-22T05:10:02.494Z",
eventlogging_1                         |     "request_id": "b0ad2ad0-939d-11ec-902c-edb38b77fe06"
eventlogging_1                         |   },
eventlogging_1                         |   "dt": "2022-02-22T05:10:01.491Z",
eventlogging_1                         |   "http": {
eventlogging_1                         |     "request_headers": {
eventlogging_1                         |       "user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Mobile Safari/537.36"
eventlogging_1                         |     }
eventlogging_1                         |   }
eventlogging_1                         | }
eventlogging_1                         | {"name":"eventgate-wikimedia","hostname":"766f50909c18","pid":1,"level":40,"err":{"message":"Event failed validation with schema at /analytics/mediawiki/content_translation_event/1.0.0","name":"ValidationError","stack":"ValidationError: Event failed validation with schema at /analytics/mediawiki/content_translation_event/1.0.0\n    at validatorFor.then (/srv/service/node_modules/eventgate/lib/EventValidator.js:285:23)\n    at tryCatcher (/srv/service/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/srv/service/node_modules/bluebird/js/release/promise.js:547:31)\n    at Promise._settlePromise (/srv/service/node_modules/bluebird/js/release/promise.js:604:18)\n    at Promise._settlePromiseCtx (/srv/service/node_modules/bluebird/js/release/promise.js:641:10)\n    at_drainQueueStep (/srv/service/node_modules/bluebird/js/release/async.js:97:12)\n    at _drainQueue (/srv/service/node_modules/bluebird/js/release/async.js:86:9)\n    at Async._drainQueues (/srv/service/node_modules/bluebird/js/release/async.js:102:5)\n    at Immediate.Async.drainQueues [as _onImmediate] (/srv/service/node_modules/bluebird/js/release/async.js:15:14)\n    at runCallback (timers.js:705:18)\n    at tryOnImmediate (timers.js:676:5)\n    at processImmediate (timers.js:658:5)","errors":[{"keyword":"required","dataPath":"","schemaPath":"#/required","params":{"missingProperty":"content_translation_session_position"},"message":"should have required property 'content_translation_session_position'"}],"errorsText":"'' should have required property 'content_translation_session_position'"},"msg":"event failed schema validation.","time":"2022-02-22T05:16:52.785Z","v":0}

This is the payload:

$schema: "/analytics/mediawiki/content_translation_event/1.0.0"
access_method: "desktop"
content_translation_session_id: "cx_sx_c18ed0109578987ac734_desktop_es"
dt: "2022-02-22T05:16:51.779Z"
event_source: "suggestion_no_seed"
event_type: "dashboard_translation_start"
meta: {stream: "mediawiki.content_translation_event", domain: "es.mediawiki.mwdd.localhost"}
domain: "es.mediawiki.mwdd.localhost"
stream: "mediawiki.content_translation_event"
translation_type: "section"
user_global_edit_count: 152
user_global_edit_count_bucket: "100-999 edits"
user_is_anonymous: false
user_name: "Admin"
wiki_db: "es"

image.png (152×594 px, 19 KB)

The instrumentation of the entrypoints basically refers to properly logging the dashboard_open event, which is logged with content_translation_session_position property always set to 0. This is fine for the instrumentation of the entrypoints, since the dashboard is always the first step inside SX application for a user coming from an entrypoint. The errors mentioned above refer to other events (e.g. dashboard_translation_start) where content_translation_session_position property is missing. For these reasons I think that this task can be closed.

For reference these are the following entrypoints currently supported with their respective event_source property:

Entrypoint nameEvent source
mflanguagesearchercontent_language_selector
mfrecenttranslationrecent_translation
mfrecenteditrecent_edit
mffrequentlanguagesfrequent_languages