Analytics: Fix metanalytics sending 'undefined' to backend (#80127)

* fix metanalytics sending 'undefined'

* revert panelId defined

* Update public/app/features/query/state/queryAnalytics.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

* finish fix

---------

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
This commit is contained in:
Jo 2024-01-08 17:06:06 +01:00 committed by GitHub
parent cff1ad4922
commit c60a1dddc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@ export function emitDataRequestEvent(datasource: DataSourceApi) {
datasourceUid: datasource.uid,
datasourceType: datasource.type,
dataSize: 0,
panelId: 0,
duration: data.request.endTime! - data.request.startTime,
};
@ -60,7 +61,9 @@ export function emitDataRequestEvent(datasource: DataSourceApi) {
eventData.totalQueries = Object.keys(queryCacheStatus).length;
eventData.cachedQueries = Object.values(queryCacheStatus).filter((val) => val === true).length;
eventData.panelId = data.request!.panelId;
if (data.request && Number.isInteger(data.request.panelId)) {
eventData.panelId = data.request.panelId;
}
const dashboard = getDashboardSrv().getCurrent();
if (dashboard) {