User story
As owner of an experiment which has been analyzed automatically, I want to easily navigate to the report (https://superset.wikimedia.org/superset/dashboard/experiment-analytics/) to view the results of my experiment without needing to browse through all the analyzed experiments and select my specific one.
Solution
We'll provide links to Superset and xLab's documentation from 1) the Instrumentation Directory (table Actions Menu) and 2) the experiment's read view page. Messages and links will vary depending on whether the experiments have been registered or have started (please consult specs). We'll prompt users to register their experiments right after configuration.
Acceptance criteria
- When viewing a configured experiment in xLab, if the experiment is active or has concluded then the page should have a custom link to Superset. The link should take the user to the experiment analytics Superset dashboard with the Experiment filter pre-filled.
- The link is clearly marked that the experiment must have been registered for automated analysis for the results to be available in Superset.
- For all user traffic (edge unique-based) experiments, maybe there should be 3 links – one for each user auth segment: All, Logged-out only, and Logged-out only
Implementation notes
From https://www.blef.fr/superset-filters-in-url/#i-want-to-preselect-my-native-filters:
In order to filter you will have to feed the native_filters param with the following (awful) pattern. The param uses the RISON format which is a JSON serialization more friendly for url params. In this pattern you will have to replace:
- <id> — contains the native filter id. You can get the filter id when you edit your "Dashboard properties" in the advance part by looking at the JSON metadata.
- <column> — the column you want to filter on. Be careful you have to use the column name and not the filter name.
- <value> — the value you want to select. Depending on what you want to do you can change the operation, in the example I use a op:IN but it can be something else.
native_filters=(NATIVE_FILTER-<id>:(__cache:(label:'<value>',validateStatus:!f,value:!('<value>')),extraFormData:(filters:!((col:<column>,op:IN,val:!('<value>')))),filterState:(label:'<value>',validateStatus:!f,value:!('<value>')),id:NATIVE_FILTER-<id>,ownState:()))
Testing this in Python:
uri_template = "https://superset.wikimedia.org/superset/dashboard/experiment-analytics/?native_filters=({native_filters})" native_filter_template = "NATIVE_FILTER-{id}:(__cache:(label:'{value}',validateStatus:!f,value:!('{value}')),extraFormData:(filters:!((col:{column},op:IN,val:!('{value}')))),filterState:(label:'{value}',validateStatus:!f,value:!('{value}')),id:NATIVE_FILTER-{id},ownState:())" experiment_name_params = { "id": "Cff2AKkC8", "column": "experiment_name", "value": "[DEMO] Reading (Balanced, Very Large)" } experiment_name_filter = native_filter_template.format(**experiment_name_params) user_auth_segment_params = { "id": "2jhAiaKCI", "column": "user_auth_segment", "value": "Logged-out only" } user_auth_segment_filter = native_filter_template.format(**user_auth_segment_params) native_filters = ','.join([experiment_name_filter, user_auth_segment_filter]) print(uri_template.format(native_filters = native_filters))
Produces
https://superset.wikimedia.org/superset/dashboard/experiment-analytics/?native_filters=(NATIVE_FILTER-Cff2AKkC8:(__cache:(label:'[DEMO] Reading (Balanced, Very Large)',validateStatus:!f,value:!('[DEMO] Reading (Balanced, Very Large)')),extraFormData:(filters:!((col:experiment_name,op:IN,val:!('[DEMO] Reading (Balanced, Very Large)')))),filterState:(label:'[DEMO] Reading (Balanced, Very Large)',validateStatus:!f,value:!('[DEMO] Reading (Balanced, Very Large)')),id:NATIVE_FILTER-Cff2AKkC8,ownState:()),NATIVE_FILTER-2jhAiaKCI:(__cache:(label:'Logged-out only',validateStatus:!f,value:!('Logged-out only')),extraFormData:(filters:!((col:user_auth_segment,op:IN,val:!('Logged-out only')))),filterState:(label:'Logged-out only',validateStatus:!f,value:!('Logged-out only')),id:NATIVE_FILTER-2jhAiaKCI,ownState:()))which should take you to directly to "[DEMO] Reading (Balanced, Very Large)" experiment, "Logged-out only" user auth segment results.




