Page MenuHomePhabricator

Scope: expose metabase usage log information
Open, Needs TriagePublic

Description

One of the features of the enterprise version of Metabase (we're running the open source version) is to provide usage metrics/analytics. See: https://www.metabase.com/features/usage-analytics

Purpose of this task is to scope this problem: What information can we provide (via metabase itself?) that could replicate some of the most important aspects of this feature (in conversation with FR-Analytics on what those are)? How difficult would that be and how long (ish) would it take to implement?

Event Timeline

AKanji-WMF added subscribers: Jgreen, AKanji-WMF.

@Jgreen flagging in case this duplicates an existing task.

There are two tables in the metabase mariadb database that could be useful:

MariaDB [metabase]> desc login_history;
+--------------------+--------------+------+-----+----------------------+----------------+
| Field              | Type         | Null | Key | Default              | Extra          |
+--------------------+--------------+------+-----+----------------------+----------------+
| id                 | int(11)      | NO   | PRI | NULL                 | auto_increment |
| timestamp          | timestamp(6) | NO   | MUL | current_timestamp(6) |                |
| user_id            | int(11)      | NO   | MUL | NULL                 |                |
| session_id         | varchar(254) | YES  | MUL | NULL                 |                |
| device_id          | char(36)     | NO   |     | NULL                 |                |
| device_description | longtext     | YES  |     | NULL                 |                |
| ip_address         | longtext     | YES  |     | NULL                 |                |
+--------------------+--------------+------+-----+----------------------+----------------+

MariaDB [metabase]> desc recent_views;
+-----------+--------------+------+-----+----------------------+----------------+
| Field     | Type         | Null | Key | Default              | Extra          |
+-----------+--------------+------+-----+----------------------+----------------+
| id        | int(11)      | NO   | PRI | NULL                 | auto_increment |
| user_id   | int(11)      | NO   | MUL | NULL                 |                |
| model     | varchar(16)  | NO   |     | NULL                 |                |
| model_id  | int(11)      | NO   |     | NULL                 |                |
| timestamp | timestamp(6) | NO   |     | current_timestamp(6) |                |
| context   | varchar(256) | NO   |     | view                 |                |
+-----------+--------------+------+-----+----------------------+----------------+

It's not clear what's ending up in recent_views, there are rows going back a year but only ~2k total.

Additionally, nginx logs have:

IP
Request time               
URL (api/dashboard/45/dashcard/1187/card/1145/query)
Referrer dashboard/45-fy2526-sms-dashboard)
Email (extracted from client cert)