Page MenuHomePhabricator

Record server-side interaction event for IRS non-emergency flow submissions
Open, In Progress, Needs TriagePublic

Description

We would like to create a record of non-emergency flow submissions within the Incident Reporting System. Until the database backend in T345246 is implemented, we should do this via a server-side interaction event.

AC

  • Completing the non-emergency flow posts to the same report API in ReportIncident as before
    • An interaction event is recorded via EventLogging:
    • Event schema:
action: submit
action_source: api
action_context: {"type": <selected incident type>, "reportedUser":<reportedUserId>}

Event Timeline

Change #1098005 had a related patch set uploaded (by Kosta Harlan; author: Máté Szabó):

[mediawiki/extensions/ReportIncident@master] api: Update server-side processing for new IRS flow

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

Change #1098005 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] api: Update server-side processing for new IRS flow

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

Change #1098516 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[integration/config@master] zuul: Test ReportIncident with EventLogging

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

Change #1098516 merged by jenkins-bot:

[integration/config@master] zuul: Test ReportIncident with EventLogging

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

Change #1098560 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[mediawiki/extensions/ReportIncident@master] api: Record server-side interaction event for non-emergency submits

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

Change #1098561 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[operations/mediawiki-config@master] Allow IRS to record server-side interaction events

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

Change #1098560 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] api: Record server-side interaction event for non-emergency submits

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

QA Notes

As a prerequisite, install and configure the EventBus, EventLogging and EventStreamConfig extensions:

wfLoadExtensions( [
	'EventBus',
	'EventStreamConfig',
	'EventLogging',
] );

$wgEventLoggingStreamNames = ['mediawiki.product_metrics.incident_reporting_system_interaction'];

$wgEventStreams = [
	'mediawiki.product_metrics.incident_reporting_system_interaction' => [
		'schema_title' => 'analytics/product_metrics/web/base',
		'destination_event_service' => 'eventgate-analytics-external',
		'producers' => [
			'mediawiki_eventbus' => [
				'event_service_name' => 'eventgate-analytics-external',
			],
			'metrics_platform_client' => [
				'provide_values' => [
					'page_id',
					'page_title',
					'page_namespace_id',
					'performer_language',
					'performer_language_variant',
					'performer_session_id',
					'performer_active_browsing_session_token',
					'performer_name',
				],
			],
		],
	]
];

$wgEventServices = [
	'eventgate-analytics-external' => [
		'url' => 'http://127.0.0.1:8192/v1/events',
		'timeout' => 5,
	],
];

$wgEnableEventBus = 'TYPE_EVENT';

Then:

  1. Clone https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia somewhere and install dependencies via npm ci.
  2. Run npm exec eventgate-wikimedia-dev from the root of this repo.
  3. Go through the IRS non-emergency flow.

In the terminal tab where eventgate-wikimedia-dev is running, you should receive output similar to the following:

{
  "http": {
    "request_headers": {
      "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
    }
  },
  "meta": {
    "domain": "enwiki.home.arpa",
    "stream": "mediawiki.product_metrics.incident_reporting_system_interaction",
    "id": "0422fc49-ad09-4ab9-ad1f-224d40a89a79",
    "dt": "2024-11-28T11:18:42.377Z",
    "request_id": "abcbe0fda327f0ff5a169ad4"
  },
  "dt": "2024-11-28T11:18:41Z",
  "action": "submit",
  "action_source": "api",
  "action_context": "{\"type\":\"intimidation\",\"reportedUserId\":19}",
  "$schema": "/analytics/product_metrics/web/base/1.3.0",
  "page": {
    "id": 15,
    "title": "Main_Page"
  },
  "performer": {
    "language": "en",
    "language_variant": "en",
    "name": "Bástya elvtárs"
  },
  "agent": {
    "client_platform": "mediawiki_php",
    "client_platform_family": "desktop_browser"
  }
}

The type in the action_context field should reflect the type of behavior selected on the second screen of the flow, the page data should match the page that was reported, and the performer data should be the data of the user that submitted the report.

Change #1098561 merged by jenkins-bot:

[operations/mediawiki-config@master] Allow IRS to record server-side interaction events

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

Mentioned in SAL (#wikimedia-operations) [2024-11-28T14:08:27Z] <urbanecm@deploy2002> Started scap sync-world: Backport for [[gerrit:1098561|Allow IRS to record server-side interaction events (T380599)]], [[gerrit:1098939|Revert^2 "Add contact form for U4C"]]

Mentioned in SAL (#wikimedia-operations) [2024-11-28T14:14:37Z] <urbanecm@deploy2002> nmw03, mszabo, urbanecm: Backport for [[gerrit:1098561|Allow IRS to record server-side interaction events (T380599)]], [[gerrit:1098939|Revert^2 "Add contact form for U4C"]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-11-28T14:22:35Z] <urbanecm@deploy2002> Finished scap sync-world: Backport for [[gerrit:1098561|Allow IRS to record server-side interaction events (T380599)]], [[gerrit:1098939|Revert^2 "Add contact form for U4C"]] (duration: 14m 07s)

  NODES
Note 4
Project 8