FileImport: add interaction reporting for dropping files (#67512)

add interaction reporting for dragndrop
This commit is contained in:
Oscar Kilhed 2023-04-28 18:41:00 +02:00 committed by GitHub
parent e88e50efe4
commit 149adb0992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -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<Props, State> {
)
);
});
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 {

View File

@ -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<Props, State> {
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 };
}),
});
});
};