Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Invalid | None | T309602 VisualEditorFeatureUse Migration to MP | |||
Resolved | • EChetty | T309306 Allow a stream to register interest in multiple events more easily | |||
Open | None | T276378 EPIC: Release Metrics Platform v1 | |||
Open | None | T309313 Minimise bytes transferred in Metrics Platform client | |||
Resolved | phuedx | T281761 Incorporate librarized Metrics Platform JS client into EventLogging | |||
Resolved | • Mholloway | T281755 Conslidate Metrics Platform JS client into mediawiki/libs/metrics-platform |
Event Timeline
AIUI this'll require:
- Downloading the tarball of https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/libs/metrics-platform/+/refs/heads/master/js/ to, say, EventLogging/libs/metrics-platform/js/
- Update the ext.eventLogging Resource Loader module to
- require the library
- Define the MediaWikiMetricsClientIntegration integration, an implementation of IMetricsClientIntegration
- Construct an instance of MetricsClient with the the above integration and the stream configurations sent to the client
- Make mw.eventLog.submit defer to MetricsClient::submit():
var metricsClient = new MetricsClient( new MediaWikiMetricsClientIntegration(), config.streamConfigs ); // Later... mw.eventLog.submit = metricsClient.submit.bind( metricsClient );
A couple of notes/questions that I made whilst exploring the above:
- AssociationController's notion of a session ID differs from the current Event Platform client's notion of one – the latter persists the session ID in a session cookie and can have the value reset when the SessionLength instrument determines that the session has reset. For now, the simplest way to bring AssociationController and EventLogging/Event Platform in line here would be to have AssociationController defer to IMetricsClientIntegration::getSessionId()
- "Debug mode" is somewhat ambiguous. In the context of the EventLogging and Event Platform, debug mode could refer to either:
- Resource Loader's debug mode; or
- The "client-side debug mode" enabled by setting your eventlogging-display-web user preference (see the comment at the top of https://gerrit.wikimedia.org/g/mediawiki/extensions/EventLogging/+/9859e766d7ace5b5c93723d00512cfc73a709b58/modules/ext.eventLogging.debug/debug.js)
- There's a minor inconsistency between SamplingController::streamInSample() and mw.eventLog.streamInSample where the latter always returns true if debug mode 2 is enabled
Change 754002 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/extensions/EventLogging@master] WIP: Integrate mediawiki/libs/metrics-platform
@jlinehan and I agree that it's option 2. I've updated https://gerrit.wikimedia.org/r/754002 accordingly.
Change 759251 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/libs/metrics-platform@master] Get pageview/session ID from IMetricsClientIntegration
@Krinkle: I've been tasked with integrating the JS Metrics Platform client in EventLogging, which is tracked in this task. Would you be able to both a code-review and performance review of the integration patch?
You may or may not have seen Jason Linehan and Michael Holloway's work related to this in EventLogging or in lib/metrics-platform. If you haven't, a very high-level overview is that we're looking to move the collection of a lot of standardised data sent by all instruments into the stream configuration, thereby allowing instrument developers to focus solely on collecting data in their domain. Some more detail is available here (and more detail will be added in the near future).
@Krinkle: My apologies. I've had feedback on the in-flight work to introduce a schema to validate the events sent by the Metrics Platform clients. A number of properties have changed names and locations and so the patch to integrate the JavaScript Metrics Platform client with EventLogging hasn't settled. That said, the overall approach will remain the same and so I can still address feedback on it.
Change 762457 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/libs/metrics-platform@master] Add MetricsClient::dispatch()
Change 759251 merged by jenkins-bot:
[mediawiki/libs/metrics-platform@master] [JS] Get pageview/session ID from IMetricsClientIntegration
Change 769441 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/libs/metrics-platform@master] [JS] Add MetricsClientIntegration::onSubmit()
Change 769441 merged by jenkins-bot:
[mediawiki/libs/metrics-platform@master] [JS] Add MetricsClientIntegration::onSubmit()
Change 762457 merged by jenkins-bot:
[mediawiki/libs/metrics-platform@master] [JS] Add MetricsClient::dispatch()
Change 787006 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/libs/metrics-platform@master] [JS] Reduce library size
Change 787006 merged by jenkins-bot:
[mediawiki/libs/metrics-platform@master] [JS] Reduce library size
Change 754002 merged by jenkins-bot:
[mediawiki/extensions/EventLogging@master] Integrate mediawiki/libs/metrics-platform
Change 793810 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/extensions/EventLogging@master] Do not throw when calling MediaWikiMetricsClientIntegration::getContextAttributes()
Change 793824 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/extensions/WikimediaEvents@master] DNM: *WebUIActions: Migrate to Metrics Platform
Change 793835 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/extensions/WikimediaEvents@master] DNM: WebUIScroll: Migrate to Metrics Platform
Change 793810 merged by jenkins-bot:
[mediawiki/extensions/EventLogging@master] Do not throw when calling MediaWikiMetricsClientIntegration::getContextAttributes()
Change 793835 abandoned by Phuedx:
[mediawiki/extensions/WikimediaEvents@master] DNM: WebUIScroll: Migrate to Metrics Platform
Reason:
This was only a demonstration.
Here's the example stream configuration that I landed on while working through the migration:
$wgEventLoggingStreamNames = [ 'web_ui_actions_tracking', 'web_ui_actions_tracking.logged_in', ]; $wgEventStreams = [ [ 'stream' => 'web_ui_actions_tracking', 'schema_title' => '/analytics/mediawiki/client/metrics_event', 'destination_event_service' => 'eventgate-analytics-external', // NOTE: The DesktopWebUIActionsTracking and MobileWebUIActionsTracking instruments both implement // their own sampling. The last step of migrating those instruments to the Metrics Platform will be // to leverage the per-stream sampling built into the Metrics Platform client. // // 'sample' => [ // 'unit' => 'pageview', // 'rate' => $wgWMEDesktopWebUIActionsTracking, // ], 'producers' => [ 'metrics_platform_client' => [ 'events' => [ 'web.ui.init', 'web.ui.click', ], 'provide_values' => [ 'performer_is_logged_in', 'performer_session_id', 'performer_edit_count_bucket', 'mediawiki_skin', ], 'curation' => [ 'mediawiki_skin' => [ 'in' => [ 'minerva', 'vector', 'vector-2022' ], ], 'performer_is_logged_in' => [ 'equals' => false, ], ], ], ], ], [ 'stream' => 'web_ui_actions_tracking.logged_in', 'schema_title' => '/analytics/mediawiki/client/metrics_event', 'destination_event_service' => 'eventgate-analytics-external', // 'sample' => [ // 'unit' => 'pageview', // 'pageview' => $wgWMEDesktopWebUIActionsTrackingOversampleLoggedInUsers ? 1 : $wgWMEDesktopWebUIActionsTracking // ], 'producers' => [ 'metrics_platform_client' => [ 'events' => [ 'web.ui.init', 'web.ui.click', ], 'provide_values' => [ 'performer_is_logged_in', 'performer_session_id', 'performer_edit_count_bucket', 'mediawiki_skin', ], 'curation' => [ 'mediawiki_skin' => [ 'in' => [ 'minerva', 'vector', 'vector-2022' ], ], 'performer_is_logged_in' => [ 'equals' => true, ], ], ], ], ], ];
Change 799353 had a related patch set uploaded (by Phuedx; author: Phuedx):
[mediawiki/extensions/WikimediaEvents@master] *WebUIActionsTracking: Also log events via Metrics Platform
Change 793824 abandoned by Phuedx:
[mediawiki/extensions/WikimediaEvents@master] DNM: *WebUIActions: Migrate to Metrics Platform
Reason:
This was only a demonstration. I9385d615ee3e610ba3407085acccd3d41ac3504f is the first step to migrating the instruments to the Metrics Platform.