mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Logs Panel: Table UI - add explore viz type to grafana_explore_logs_result_displayed event (#80037)
* add explore visualisation type to grafana_explore_logs_result_displayed event * add log row count --------- Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
This commit is contained in:
@@ -18,7 +18,8 @@ import { organizeFieldsTransformer } from '@grafana/data/src/transformations/tra
|
||||
import { config } from '@grafana/runtime';
|
||||
import { extractFieldsTransformer } from 'app/features/transformers/extractFields/extractFields';
|
||||
|
||||
import { Logs, visualisationTypeKey } from './Logs';
|
||||
import { Logs } from './Logs';
|
||||
import { visualisationTypeKey } from './utils/logs';
|
||||
import { getMockElasticFrame, getMockLokiFrame } from './utils/testMocks.test';
|
||||
|
||||
const reportInteraction = jest.fn();
|
||||
|
||||
@@ -62,7 +62,7 @@ import { LogsMetaRow } from './LogsMetaRow';
|
||||
import LogsNavigation from './LogsNavigation';
|
||||
import { getLogsTableHeight, LogsTableWrap } from './LogsTableWrap';
|
||||
import { LogsVolumePanelList } from './LogsVolumePanelList';
|
||||
import { SETTINGS_KEYS } from './utils/logs';
|
||||
import { SETTINGS_KEYS, visualisationTypeKey } from './utils/logs';
|
||||
|
||||
interface Props extends Themeable2 {
|
||||
width: number;
|
||||
@@ -141,8 +141,6 @@ const DEDUP_OPTIONS = [
|
||||
LogsDedupStrategy.signature,
|
||||
];
|
||||
|
||||
export const visualisationTypeKey = 'grafana.explore.logs.visualisationType';
|
||||
|
||||
const getDefaultVisualisationType = (): LogsVisualisationType => {
|
||||
const visualisationType = store.get(visualisationTypeKey);
|
||||
if (visualisationType === 'table') {
|
||||
|
||||
@@ -6,3 +6,5 @@ export const SETTINGS_KEYS = {
|
||||
logsSortOrder: 'grafana.explore.logs.sortOrder',
|
||||
logContextWrapLogMessage: 'grafana.explore.logs.logContext.wrapLogMessage',
|
||||
};
|
||||
|
||||
export const visualisationTypeKey = 'grafana.explore.logs.visualisationType';
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '@grafana/data';
|
||||
import { config, getDataSourceSrv, reportInteraction } from '@grafana/runtime';
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
import store from 'app/core/store';
|
||||
import {
|
||||
buildQueryTransaction,
|
||||
ensureQueries,
|
||||
@@ -51,6 +52,7 @@ import { ExploreState, QueryOptions, SupplementaryQueries } from 'app/types/expl
|
||||
import { notifyApp } from '../../../core/actions';
|
||||
import { createErrorNotification } from '../../../core/copy/appNotification';
|
||||
import { runRequest } from '../../query/state/runRequest';
|
||||
import { visualisationTypeKey } from '../Logs/utils/logs';
|
||||
import { decorateData } from '../utils/decorators';
|
||||
import {
|
||||
getSupplementaryQueryProvider,
|
||||
@@ -633,17 +635,21 @@ export const runQueries = createAsyncThunk<void, RunQueriesOptions>(
|
||||
|
||||
newQuerySubscription = newQuerySource.subscribe({
|
||||
next(data) {
|
||||
const exploreState = getState().explore.panes[exploreId];
|
||||
if (data.logsResult !== null && data.state === LoadingState.Done) {
|
||||
reportInteraction('grafana_explore_logs_result_displayed', {
|
||||
datasourceType: datasourceInstance.type,
|
||||
visualisationType:
|
||||
exploreState?.panelsState?.logs?.visualisationType ?? store.get(visualisationTypeKey) ?? 'N/A',
|
||||
length: data.logsResult.rows.length,
|
||||
});
|
||||
}
|
||||
dispatch(queryStreamUpdatedAction({ exploreId, response: data }));
|
||||
|
||||
// Keep scanning for results if this was the last scanning transaction
|
||||
if (getState().explore.panes[exploreId]!.scanning) {
|
||||
if (exploreState!.scanning) {
|
||||
if (data.state === LoadingState.Done && data.series.length === 0) {
|
||||
const range = getShiftedTimeRange(-1, getState().explore.panes[exploreId]!.range);
|
||||
const range = getShiftedTimeRange(-1, exploreState!.range);
|
||||
dispatch(updateTime({ exploreId, absoluteRange: range }));
|
||||
dispatch(runQueries({ exploreId }));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user