diff --git a/packages/grafana-data/src/types/app.ts b/packages/grafana-data/src/types/app.ts index 47d75b91d98..40da580ae5b 100644 --- a/packages/grafana-data/src/types/app.ts +++ b/packages/grafana-data/src/types/app.ts @@ -16,6 +16,7 @@ export enum CoreApp { Unknown = 'unknown', PanelEditor = 'panel-editor', PanelViewer = 'panel-viewer', + Correlations = 'correlations', } export interface AppRootProps { diff --git a/public/app/features/correlations/Forms/QueryEditorField.test.tsx b/public/app/features/correlations/Forms/QueryEditorField.test.tsx index c908db83ed5..5dc6c820853 100644 --- a/public/app/features/correlations/Forms/QueryEditorField.test.tsx +++ b/public/app/features/correlations/Forms/QueryEditorField.test.tsx @@ -35,12 +35,12 @@ const renderWithContext = ( }; const initiateDsApi = () => { - const dsApi = new MockDataSourceApi('something'); + const dsApi = new MockDataSourceApi('dsApiMock'); dsApi.components = { QueryEditor: () => <>query editor, }; - renderWithContext(, async () => { + renderWithContext(, async () => { return dsApi; }); diff --git a/public/app/features/correlations/Forms/QueryEditorField.tsx b/public/app/features/correlations/Forms/QueryEditorField.tsx index b2267c56a4d..c1e039f7b9c 100644 --- a/public/app/features/correlations/Forms/QueryEditorField.tsx +++ b/public/app/features/correlations/Forms/QueryEditorField.tsx @@ -62,7 +62,7 @@ export const QueryEditorField = ({ dsUid, invalid, error, name }: Props) => { const transaction: QueryTransaction = { queries, request: { - app: CoreApp.Unknown, + app: CoreApp.Correlations, timezone: 'utc', startTime: Date.now(), interval, diff --git a/public/app/features/query/state/queryAnalytics.ts b/public/app/features/query/state/queryAnalytics.ts index af08f9da7f6..da61615ca61 100644 --- a/public/app/features/query/state/queryAnalytics.ts +++ b/public/app/features/query/state/queryAnalytics.ts @@ -32,8 +32,8 @@ export function emitDataRequestEvent(datasource: DataSourceApi) { duration: data.request.endTime! - data.request.startTime, }; - if (data.request.app === CoreApp.Explore) { - enrichWithExploreInfo(eventData, data); + if (data.request.app === CoreApp.Explore || data.request.app === CoreApp.Correlations) { + enrichWithInfo(eventData, data); } else { enrichWithDashboardInfo(eventData, data); } @@ -50,7 +50,7 @@ export function emitDataRequestEvent(datasource: DataSourceApi) { done = true; }; - function enrichWithExploreInfo(eventData: DataRequestEventPayload, data: PanelData) { + function enrichWithInfo(eventData: DataRequestEventPayload, data: PanelData) { const totalQueries = Object.keys(data.series).length; eventData.totalQueries = totalQueries; } @@ -71,7 +71,7 @@ export function emitDataRequestEvent(datasource: DataSourceApi) { eventData.totalQueries = totalQueries; eventData.cachedQueries = cachedQueries; - const dashboard = getDashboardSrv().dashboard; + const dashboard = getDashboardSrv().getCurrent(); if (dashboard) { eventData.dashboardId = dashboard.id; eventData.dashboardName = dashboard.title;