Page MenuHomePhabricator

[Data Persistence Design Review] Thanks
Open, Needs TriagePublic

Description

Proposal

We are building a per-editor thanks given / thanks received timeseries for the Growth ImpactModule (and Year-In-Review). Design doc: Prep Pantry Design: Thanks.
Related:
T438491: [EPIC] Instrument the Thanks extension for ImpactModule needs (epic),
T438493: Define the requirements for Thanks instrumentation (requirements),
T437053: Enable analytics instruments to subscribe to thanks (giving and receiving) (ThankEvent domain event),

The decision we are proposing for review: store the serving dataset in Cassandra (AQS cluster, analytics keyspace) and serve it through Data Gateway, as a sibling of the existing Global Editor Metrics tables (analytics.pageviews_per_editor, analytics.pageviews_top_pages_per_editor).

Thanks events would be produces whenever a thanks is given and which would be produced via Eventgate to a kafka stream mediawiki.thanks. From the Kafka the data will flow through Gobblin → Refine → Hive table → dbt → cassandra (analytics.thanks_per_user). The data product would be served via Data Gateway.

There would be a one-time historical backfill from wmf_raw.mediawiki_logging (logtype='thanks')

Data Model

Cassandra would be the storage for thanks data.

CREATE TABLE analytics.thanks_per_user (
    user_central_id bigint,
    wiki_id         text,
    granularity     text,
    dt              timestamp,
    thanks_given    int,

    thanks_received int,
    PRIMARY KEY ((user_central_id, granularity), dt, wiki_id)
) WITH CLUSTERING ORDER BY (dt DESC);

Service

Data would be served via Data Gateway

GET /public/analytics/thanks_per_user/{user_central_id}/{granularity}/{wiki_id}/{start}/{end}

The endpoint returns the thanks given and receive for a user_central_id over a start - end period.

Data Size
Retention
DatasetRetention
event.<thanks_stream> (raw events)standard 90-day purge; sanitized copy in event_sanitized kept indefinitely
wmf_contributors.thanks_by_user_daily (Iceberg mart, offline)permanent
analytics.thanks_per_user (Cassandra)permanent, no TTL