From 149adb09929cc2f165315a1f31ac4ff0332e08c3 Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Fri, 28 Apr 2023 18:41:00 +0200 Subject: [PATCH] FileImport: add interaction reporting for dropping files (#67512) add interaction reporting for dragndrop --- .../features/dashboard/containers/DashboardPage.tsx | 12 +++++++++++- .../datasource/grafana/components/QueryEditor.tsx | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index 0509763a802..e0c5cd3091b 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -16,7 +16,7 @@ import { formattedValueToString, } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; -import { config, locationService } from '@grafana/runtime'; +import { config, locationService, reportInteraction } from '@grafana/runtime'; import { Icon, Themeable2, withTheme2 } from '@grafana/ui'; import { notifyApp } from 'app/core/actions'; import { Page } from 'app/core/components/Page/Page'; @@ -166,6 +166,16 @@ export class UnthemedDashboardPage extends PureComponent { ) ); }); + + reportInteraction('dashboards_dropped_files', { + number_of_files: fileRejections.length + acceptedFiles.length, + accepted_files: acceptedFiles.map((a) => { + return { type: a.type, size: a.size }; + }), + rejected_files: fileRejections.map((r) => { + return { type: r.file.type, size: r.file.size }; + }), + }); }; getCleanState(): State { diff --git a/public/app/plugins/datasource/grafana/components/QueryEditor.tsx b/public/app/plugins/datasource/grafana/components/QueryEditor.tsx index b26b7689976..7a476150fb1 100644 --- a/public/app/plugins/datasource/grafana/components/QueryEditor.tsx +++ b/public/app/plugins/datasource/grafana/components/QueryEditor.tsx @@ -16,7 +16,7 @@ import { getValueFormat, formattedValueToString, } from '@grafana/data'; -import { config, getBackendSrv, getDataSourceSrv } from '@grafana/runtime'; +import { config, getBackendSrv, getDataSourceSrv, reportInteraction } from '@grafana/runtime'; import { InlineField, Select, @@ -391,6 +391,16 @@ export class UnthemedQueryEditor extends PureComponent { snapshot, }); this.props.onRunQuery(); + + reportInteraction('grafana_datasource_drop_files', { + number_of_files: fileRejections.length + acceptedFiles.length, + accepted_files: acceptedFiles.map((a) => { + return { type: a.type, size: a.size }; + }), + rejected_files: fileRejections.map((r) => { + return { type: r.file.type, size: r.file.size }; + }), + }); }); };