The Redash dashboard utilities for Firefox Messaging System
Перейти к файлу
Nan Jiang bcd978d304
Merge pull request #2 from mozilla/dependabot/pip/pyyaml-5.4
Bump pyyaml from 5.3 to 5.4
2021-06-01 16:12:10 -04:00
templates Add WNP 85 2021-01-27 10:47:19 -05:00
.gitignore Initial commit 2020-02-20 13:40:45 -05:00
CODE_OF_CONDUCT.md Add license and coc 2020-02-28 10:19:40 -05:00
LICENSE Add license and coc 2020-02-28 10:19:40 -05:00
README.md Rename bar chart to column 2020-05-06 09:29:02 -04:00
cfr_exp_template_config.yaml Add homepage CFR experiments 2020-11-18 14:51:45 -05:00
cfr_template_config.yaml Add template generator for regular CFR 2020-05-05 21:20:43 -04:00
generate.py Update WNP template and create wnp 80 2020-08-25 11:03:49 -04:00
generate_template.py Add template generator for regular CFR 2020-05-05 21:20:43 -04:00
onboarding_template_config.yaml Add multistage about:welcome 2020-08-05 10:41:47 -04:00
requirements.txt Bump pyyaml from 5.3 to 5.4 2021-06-01 20:11:53 +00:00
wnp_template_config.yaml Add WNP 85 2021-01-27 10:47:19 -05:00

README.md

Auto generate dashboard on Redash for User Journey

Install

# This utility requires Python 3, highly recommended to use the virtual environment
$ virtualenv venv
$ source venv/bin/activate

# Install dependencies
$ pip install -r requirements.txt

# Make sure get your Redash API key, it's available on Redash `Edit Profile -> Settings -> API Key`
# You can add it to your shell profile, such as `export REDASH_API_KEY="your_api_key"`.

Usage

Dashboard Template

Each dashboard is defined by a dashboard template file (YAML), which, in turn, is comprised of a title and a list of charts.

Define Chart

Each dashboard consists of multiple charts, and each chart can be defined as follows:

title: "WNP 72: Badge Impression&Clicks"
type: line
query: |
  SELECT EXTRACT(date from submission_timestamp) as date,
   event,
   count(*) as count,
  FROM messaging_system.cfr
  WHERE EXTRACT(date FROM submission_timestamp) BETWEEN '2020-01-07' AND '2020-02-10'
    AND release_channel = 'release'
    AND version LIKE '72%'
    AND event in ('IMPRESSION', 'CLICK')
    AND message_id = 'WHATS_NEW_BADGE_72'
  GROUP BY 1, 2  
x_axis: date
y_axis: count
group_by: event

Most properties are self-explained,

  • The query, defined by the author, provides the input of this chart
  • The type sets the chart type, it could be "line", "area", "column", "pie", "scatter", "bubble", "box", "pivot", and "table"
  • The x_axis and y_axis set the axes, they should be the columns from the SELECT statement in the query
  • The x axis could be further broken down by the group_by.

Generate Dashboard

Once the template is defined, you can generate a dashboard with the generator.

For instance, to generate a dashboard for the "What's New Panel".

$ ./generate.py templates/whats-new-panel.yaml

Then you can go to Redash, click on Dashboards on the top-left, you should find the new dashboard (already published) there.

Note that for each chart, there should be a new query crated on Redash, though it's not published. You can find them in the Queries section on Redash.

Predefined templates

For those recurring experiments and features like CFR, Onboarding, and Whats-new-panel, we have various template generators available for you to easily generate Redash templates.

$ ./generate_template.py [cfr|cfr-exp|wnp|onboarding] /path/to/output.yaml

# this generates a CFR experiment dashboard template
$ ./generate_template.py cfr-exp template/cfr/cfr-exp-foo.yaml

# then you can use this template to generate the dashboard
$ ./generate.py template/cfr/cfr-exp-foo.yaml