FlameGraph: Add user interaction reporting (#68458)

This commit is contained in:
Andrej Ocenas 2023-05-15 15:02:37 +02:00 committed by GitHub
parent 35ccfa6131
commit 47b7b05591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -4,8 +4,10 @@ import useDebounce from 'react-use/lib/useDebounce';
import usePrevious from 'react-use/lib/usePrevious';
import { GrafanaTheme2, CoreApp } from '@grafana/data';
import { reportInteraction } from '@grafana/runtime';
import { Button, Input, RadioButtonGroup, useStyles2 } from '@grafana/ui';
import { config } from '../../../../core/config';
import { MIN_WIDTH_TO_SHOW_BOTH_TOPTABLE_AND_FLAMEGRAPH } from '../constants';
import { SelectedView } from './types';
@ -85,6 +87,11 @@ const FlameGraphHeader = ({
options={viewOptions}
value={selectedView}
onChange={(view) => {
reportInteraction('grafana_flamegraph_view_selected', {
app,
grafana_version: config.buildInfo.version,
view,
});
setSelectedView(view);
}}
/>

View File

@ -3,7 +3,7 @@ import React, { useState } from 'react';
import AutoSizer from 'react-virtualized-auto-sizer';
import { applyFieldOverrides, CoreApp, DataFrame, DataLinkClickEvent, Field, FieldType } from '@grafana/data';
import { config } from '@grafana/runtime';
import { config, reportInteraction } from '@grafana/runtime';
import { Table, TableSortByFieldState, useStyles2 } from '@grafana/ui';
import { PIXELS_PER_LEVEL, TOP_TABLE_COLUMN_WIDTH } from '../../constants';
@ -41,6 +41,10 @@ const FlameGraphTopTableContainer = ({
if (search === symbol) {
setSearch('');
} else {
reportInteraction('grafana_flamegraph_table_item_selected', {
app,
grafana_version: config.buildInfo.version,
});
setSearch(symbol);
// Reset selected level in flamegraph when selecting row in top table
setTopLevelIndex(0);
@ -65,6 +69,13 @@ const FlameGraphTopTableContainer = ({
<Table
initialSortBy={sort}
onSortByChange={(s) => {
if (s && s.length) {
reportInteraction('grafana_flamegraph_table_sort_selected', {
app,
grafana_version: config.buildInfo.version,
sort: s[0].displayName + '_' + (s[0].desc ? 'desc' : 'asc'),
});
}
setSort(s);
}}
data={frame}