Page MenuHomePhabricator

Test schema and stream for analytics events
Closed, ResolvedPublic

Description

There's currently a /test/event schema in primary repository for simple testing of "production" events, but not for testing "analytics" events.

Specifically, it's missing client_dt field (from /fragments/analytics/common schema fragment in secondary repo) that Event Platform Clients (e.g. EventLogging on MediaWiki) include in events. In case of Event Platform Client for iOS in the Wikipedia app, that also attaches a device_id and a session_id to all events, which are fields that are being added (along with a pageview_id field) in the /fragments/analytics/identifiers schema fragment, currently in code review)

This came up in a conversation between @mpopov and @Tsevener about adding calls to test event logging using the new client library in the Wikipedia app for iOS. Those events would be sent, sure, but they wouldn't be valid against the existing test schema.

So, we need a /analytics/test schema in the secondary repo that will ref /fragments/analytics/common and /fragments/analytics/identifiers and – just like the /test/event schema in primary repo – it would just have these fields:

test:
  type: string
  default: default value
test_map:
  description: >
    We want to support 'map' types using additionalProperties to specify the value types.  (Keys are always strings.)
  type: object
  additionalProperties:
    type: string

We would also need to deploy a stream that uses that schema – "analytics.test" or "test.analytics"?

Related Objects

StatusSubtypeAssignedTask
Open DAbad
DeclinedNone
DeclinedOttomata
DeclinedNone
Resolvedkzimmerman
Resolvedmpopov
OpenNone
Resolved DAbad
Resolved jlinehan
OpenNone
Resolved Mholloway
OpenNone
OpenNone
Resolved Mholloway
OpenNone
Resolvedmpopov
Resolvedmpopov
Resolvedphuedx
Resolvedcjming
Resolved Mholloway
Resolvedcjming
Resolvedcjming
Resolvedcjming
Resolvedcjming

Event Timeline

mpopov triaged this task as High priority.Aug 5 2020, 2:05 PM
mpopov created this task.
mpopov moved this task from Inbox to Backlog on the Better Use Of Data board.

Marking this as high priority since we need to have simple ability to test event logging as soon as possible.

Change 622169 had a related patch set uploaded (by Bearloga; owner: Bearloga):
[schemas/event/secondary@master] Create analytics/test/event schema

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

Change 622169 merged by Bearloga:
[schemas/event/secondary@master] Create analytics/test schema

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

Change 622604 had a related patch set uploaded (by Bearloga; owner: Bearloga):
[operations/mediawiki-config@master] wgEventStreams: Streams for testing MEP-based analytics instruments

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

Change 622604 merged by Ottomata:
[operations/mediawiki-config@master] wgEventStreams: Streams for testing MEP-based analytics instruments

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

Mentioned in SAL (#wikimedia-operations) [2020-08-27T20:43:15Z] <otto@deploy1001> Synchronized wmf-config/InitialiseSettings.php: wgEventStreams: Streams for testing MEP-based analytics instruments - T259714 (duration: 00m 55s)

2020-08-27 18:55:05.180043-0400 Wikipedia[8891:260268] 2020-08-27 18:55:05:180 Wikipedia[main] log(stream:schema:data:domain:)#L612 D: EPC: Event logged to stream 'test.instrumentation' (schema: '/analytics/test/1.0.0'):
{
  "test_map" : {
    "file" : "Application\/App View Controller\/WMFAppViewController.m",
    "method" : "showSettingsWithSubViewController()"
  },
  "test_string" : "Opened Settings screen",
  "meta" : {

  },
  "client_dt" : "2020-08-27T22:55:05Z",
  "app_session_id" : "8e69dacadb9ebd5148c7"
}
2020-08-27 18:55:05.180436-0400 Wikipedia[8891:260267] 2020-08-27 18:55:05:180 Wikipedia[main] log(stream:schema:data:domain:)#L657 D: EPC: Sending HTTP request to https://intake-analytics.wikimedia.org/v1/events with POST body: {"test_map":{"file":"Application\/App View Controller\/WMFAppViewController.m","method":"showSettingsWithSubViewController()"},"$schema":"\/analytics\/test\/1.0.0","meta":{"stream":"test.instrumentation","id":"4C625BFF-0BF9-4F9D-9C1D-2B516E8C7940"},"test_string":"Opened Settings screen","client_dt":"2020-08-27T22:55:05Z","app_install_id":"BC84A66D-6603-4BE0-9812-4967374C2812","app_session_id":"8e69dacadb9ebd5148c7"}

020-08-27 18:56:35.148531-0400 Wikipedia[8891:261117] 2020-08-27 18:56:35:148 Wikipedia[main] log(stream:schema:data:domain:)#L612 D: EPC: Event logged to stream 'test.instrumentation' (schema: '/analytics/test/1.0.0'):
{
  "test_map" : {
    "method" : "refreshControlActivated",
    "file" : "Features\/Feed\/ExploreViewController.swift"
  },
  "client_dt" : "2020-08-27T22:56:35Z",
  "test_string" : "Explore Feed refreshed",
  "app_session_id" : "8e69dacadb9ebd5148c7",
  "meta" : {

  }
}
2020-08-27 18:56:35.148672-0400 Wikipedia[8891:261117] 2020-08-27 18:56:35:149 Wikipedia[main] log(stream:schema:data:domain:)#L657 D: EPC: Sending HTTP request to https://intake-analytics.wikimedia.org/v1/events with POST body: {"meta":{"stream":"test.instrumentation","id":"DD9A6CBD-C94C-4332-8880-131A0ED72EEF"},"client_dt":"2020-08-27T22:56:35Z","app_install_id":"BC84A66D-6603-4BE0-9812-4967374C2812","test_map":{"method":"refreshControlActivated","file":"Features\/Feed\/ExploreViewController.swift"},"app_session_id":"8e69dacadb9ebd5148c7","$schema":"\/analytics\/test\/1.0.0","test_string":"Explore Feed refreshed"}

These two events in Grafana:

Screen Shot 2020-08-27 at 6.58.07 PM.png (1×3 px, 287 KB)

Hoping to see them in events.test_instrumentation soon!

Verified that the events made it into the database:

Screen Shot 2020-08-28 at 9.59.13 AM.png (1×2 px, 316 KB)