Phase 2 (Sampling)
Per-stream uniform sampling rate can be set by a stream configuration field.
As documented in: https://www.mediawiki.org/wiki/Wikimedia_Product/Analytics_Infrastructure/Stream_configuration#Sampling_settings
Phase 2 (Sampling)
Per-stream uniform sampling rate can be set by a stream configuration field.
As documented in: https://www.mediawiki.org/wiki/Wikimedia_Product/Analytics_Infrastructure/Stream_configuration#Sampling_settings
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Process sampling rules in stream config | mediawiki/extensions/EventLogging | master | +156 -10 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Declined | None | T259734 BUOD-KR1-Q4+: Certify that analytics schema and instruments have been upgraded to use the MEP system (clearing the legacy system for sunsetting) | |||
Declined | Ottomata | T259157 BUOD-KR1-Q3: Require that all new schema/instruments are created with the MEP system | |||
Declined | None | T259704 BUOD-KR1-Q2: Upgrade MEP clients to full release status | |||
Resolved | kzimmerman | T259169 BUOD-KR1-Q1: Pilot MEP clients with 2 product teams | |||
Resolved | • jlinehan | T259710 MEP pilot instrument/schema #2 (SessionLength) | |||
Resolved | mpopov | T238544 MEP Client MediaWiki JS (MVP) | |||
Resolved | mpopov | T234594 EventLogging MEP Upgrade Phase 2 (Sampling) |
For testing in MediaWiki Vagrant, I had the following to LocalSettings.php:
$wgEventStreams = [ [ 'stream' => 'analytics.link_hover', 'schema_title' => 'analytics/link_hover', ], [ 'stream' => 'pageview', 'schema_title' => 'analytics/pageview', 'sampling' => [ 'rate' => 0.5, 'identifier' => 'pageview' ], ], [ 'stream' => 'mobile_apps.session', 'schema_title' => 'analytics/mobile_apps/session', 'sampling' => [ 'identifier' => 'device' ], ], ]; $wgEventLoggingStreamNames = [ 'analytics.link_hover', 'pageview', 'edit', 'edit.growth', 'mobile_apps.session', ];
And used the following instrumentation:
( function() { $( document ).ready( function() { var pageEvent = { $schema: '/analytics/pageview/1.0.0', page_token: mw.user.getPageviewToken(), session_id: mw.user.sessionId() }; mw.eventLog.submit( 'pageview', pageEvent ); // will be sent approx. half the time mw.eventLog.submit( 'mobile_apps.session', { $schema: '/analytics/mobile_apps/session/1.0.0' } ); // will not be sent }); // From https://wikitech.wikimedia.org/wiki/Event_Platform/Instrumentation_How_To: $( '#content' ).on( 'mouseover', 'a.extiw', function ( jqEvent ) { var link = jqEvent.target; var linkHoverEvent = { // $schema is required and must be set to the exact value of $id that you set in your schema. $schema: '/analytics/link_hover/1.0.0', link_href: link.href, link_title: link.title, }; var streamName = 'analytics.interwiki_link_hover'; console.log("logging event with data " + JSON.stringify(linkHoverEvent) + " to stream '" + streamName + "'"); mw.eventLog.submit( streamName, linkHoverEvent ); } ); }() );
Change 602739 had a related patch set uploaded (by Bearloga; owner: Bearloga):
[mediawiki/extensions/EventLogging@master] Process sampling rules in stream config
Change 602739 merged by jenkins-bot:
[mediawiki/extensions/EventLogging@master] Process sampling rules in stream config