@@ -4,42 +4,24 @@ import { PYROSCOPE_APP_ID, ROUTES } from '../../constants';
44import { LayoutType } from '../../pages/ProfilesExplorerView/components/SceneByVariableRepeaterGrid/components/SceneLayoutSwitcher' ;
55import { PanelType } from '../../pages/ProfilesExplorerView/components/SceneByVariableRepeaterGrid/components/ScenePanelTypeSwitcher' ;
66
7- const PROFILES_EXPLORER_PAGE_NAME = ROUTES . PROFILES_EXPLORER_VIEW . slice ( 1 ) ;
8-
9- function getCurrentPage ( ) : string {
10- const { pathname } = new URL ( window . location . toString ( ) ) ;
11- return pathname . split ( '/' ) . pop ( ) || '' ;
12- }
13-
14- function getExtraProperties ( ) {
15- const page = getCurrentPage ( ) ;
16- const version = config . apps [ PYROSCOPE_APP_ID ] . version ;
17- const extraProperties : Record < string , any > = { page, version } ;
18-
19- if ( page === PROFILES_EXPLORER_PAGE_NAME ) {
20- extraProperties . explorationType = new URLSearchParams ( window . location . search ) . get ( 'explorationType' ) ;
21- }
22-
23- return extraProperties ;
24- }
25-
267// hey future dev: don't forget to add any new value to our features tracking dashboard!
278export type InteractionName =
289 | 'g_pyroscope_app_compare_link_clicked'
29- | 'g_pyroscope_app_diff_preset_selected'
30- | 'g_pyroscope_app_diff_preset_save_clicked'
3110 | 'g_pyroscope_app_diff_auto_select_clicked'
3211 | 'g_pyroscope_app_diff_choose_preset_clicked'
3312 | 'g_pyroscope_app_diff_learn_how_clicked'
34- | 'g_pyroscope_app_include_action_clicked'
13+ | 'g_pyroscope_app_diff_preset_save_clicked'
14+ | 'g_pyroscope_app_diff_preset_selected'
3515 | 'g_pyroscope_app_exclude_action_clicked'
3616 | 'g_pyroscope_app_explain_flamegraph_clicked'
3717 | 'g_pyroscope_app_exploration_type_clicked'
3818 | 'g_pyroscope_app_export_profile'
3919 | 'g_pyroscope_app_fav_action_clicked'
20+ | 'g_pyroscope_app_filters_changed'
4021 | 'g_pyroscope_app_function_details_clicked'
4122 | 'g_pyroscope_app_group_by_label_clicked'
4223 | 'g_pyroscope_app_hide_no_data_changed'
24+ | 'g_pyroscope_app_include_action_clicked'
4325 | 'g_pyroscope_app_layout_changed'
4426 | 'g_pyroscope_app_optimize_code_clicked'
4527 | 'g_pyroscope_app_panel_type_changed'
@@ -56,9 +38,11 @@ type InteractionProperties =
5638 // g_pyroscope_app_exploration_type_clicked
5739 | { explorationType : string }
5840 // g_pyroscope_app_export_profile
59- | { format : 'png' | 'json' | 'flamegraph.com' }
41+ | { format : 'png' | 'json' | 'pprof' | ' flamegraph.com' }
6042 // g_pyroscope_app_fav_action_clicked
6143 | { favAfterClick : boolean }
44+ // g_pyroscope_app_filters_changed
45+ | { name : string ; count : number ; operators : string [ ] }
6246 // g_pyroscope_app_group_by_label_clicked
6347 | { label : string }
6448 // g_pyroscope_app_hide_no_data_changed
@@ -70,6 +54,25 @@ type InteractionProperties =
7054 // g_pyroscope_app_select_action_clicked
7155 | { type : string } ;
7256
57+ const PROFILES_EXPLORER_PAGE_NAME = ROUTES . PROFILES_EXPLORER_VIEW . slice ( 1 ) ;
58+
59+ function getCurrentPage ( ) : string {
60+ const { pathname } = new URL ( window . location . toString ( ) ) ;
61+ return pathname . split ( '/' ) . pop ( ) || '' ;
62+ }
63+
64+ function getExtraProperties ( ) {
65+ const page = getCurrentPage ( ) ;
66+ const version = config . apps [ PYROSCOPE_APP_ID ] . version ;
67+ const extraProperties : Record < string , any > = { page, version } ;
68+
69+ if ( page === PROFILES_EXPLORER_PAGE_NAME ) {
70+ extraProperties . explorationType = new URLSearchParams ( window . location . search ) . get ( 'explorationType' ) ;
71+ }
72+
73+ return extraProperties ;
74+ }
75+
7376export function reportInteraction ( interactionName : InteractionName , properties ?: InteractionProperties ) {
7477 grafanaReportInteraction ( interactionName , {
7578 ...properties ,
0 commit comments