Extension:EventLogging/Data model

From MediaWiki.org
Jump to navigation Jump to search

The proposed data model for event logging leverages different data structures offered by Redis, such as (sorted) sets, lists and hashes.

Storing data[edit]

Logging event data into Redis requires:

  1. generating a uuid for each incoming event
  2. adding the uuid to a sorted set keyed to anon token with a UTC timestamp as score
  3. adding uuid to a sorted set keyed to event_id with a UTC timestamp as score
  4. generating a hash keyed to the uuid to hold all the key/vals parsed from the query string

(document basic write operations)

Querying data[edit]

Basic examples (see the full documentation on redis commands):

get all hashes for a given event
zrange et:ext.articleFeedback@10-pitch-edit-bypass 0 -1
get all hashes for a given even in a specified timeframe
zrangebyscore et:ext.articleFeedback@10-pitch-edit-show 20120917170000 20120917180000
count events by type
zcard et:ext.articleFeedback@10-pitch-edit-show
get timestamp for a hash as a score
zscore et:ext.articleFeedback@10-pitch-edit-show eb62f8a2-68fc-4984-885f-c90a1f68ccb9
get all values stored in a hash
hgetall eb62f8a2-68fc-4984-885f-c90a1f68ccb9
get value for a given hash key
hget eb62f8a2-68fc-4984-885f-c90a1f68ccb9 wiki

Questions[edit]

  • What queries will be easy to write/run?
  • What queries will be hard to write/run?
  • Capacity
  • Performance
  • Chance of collisions
  • Persistence
  • Recovery

See also[edit]