From b8b25f7e31f5b8bc982a09addf938502401e057a Mon Sep 17 00:00:00 2001 From: Gareth Dawson Date: Thu, 13 Oct 2022 14:26:59 +0100 Subject: [PATCH] Logs: add app to feature tracking in ad-hoc statistics (#56865) * add app tracking to adhoc statistics * use the object property value shorthand --- public/app/features/logs/components/LogDetails.tsx | 6 +++++- public/app/features/logs/components/LogDetailsRow.tsx | 6 ++++-- public/app/features/logs/components/LogRow.tsx | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/app/features/logs/components/LogDetails.tsx b/public/app/features/logs/components/LogDetails.tsx index 4ca59b00ed5..c030bf9f8d0 100644 --- a/public/app/features/logs/components/LogDetails.tsx +++ b/public/app/features/logs/components/LogDetails.tsx @@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css'; import memoizeOne from 'memoize-one'; import React, { PureComponent } from 'react'; -import { Field, LinkModel, LogRowModel, GrafanaTheme2 } from '@grafana/data'; +import { Field, LinkModel, LogRowModel, GrafanaTheme2, CoreApp } from '@grafana/data'; import { withTheme2, Themeable2, Icon, Tooltip } from '@grafana/ui'; import { calculateFieldStats, calculateLogsLabelStats, calculateStats, getParser } from '../utils'; @@ -20,6 +20,7 @@ export interface Props extends Themeable2 { wrapLogMessage: boolean; className?: string; hasError?: boolean; + app?: CoreApp; onClickFilterLabel?: (key: string, value: string) => void; onClickFilterOutLabel?: (key: string, value: string) => void; @@ -58,6 +59,7 @@ class UnThemedLogDetails extends PureComponent { render() { const { + app, row, theme, hasError, @@ -110,6 +112,7 @@ class UnThemedLogDetails extends PureComponent { onClickFilterOutLabel={onClickFilterOutLabel} onClickFilterLabel={onClickFilterLabel} row={row} + app={app} /> ); })} @@ -148,6 +151,7 @@ class UnThemedLogDetails extends PureComponent { showDetectedFields={showDetectedFields} wrapLogMessage={wrapLogMessage} row={row} + app={app} /> ); })} diff --git a/public/app/features/logs/components/LogDetailsRow.tsx b/public/app/features/logs/components/LogDetailsRow.tsx index 3ea32ef13b5..04f8373c151 100644 --- a/public/app/features/logs/components/LogDetailsRow.tsx +++ b/public/app/features/logs/components/LogDetailsRow.tsx @@ -1,7 +1,7 @@ import { css, cx } from '@emotion/css'; import React, { PureComponent } from 'react'; -import { Field, LinkModel, LogLabelStatsModel, GrafanaTheme2, LogRowModel } from '@grafana/data'; +import { Field, LinkModel, LogLabelStatsModel, GrafanaTheme2, LogRowModel, CoreApp } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; import { withTheme2, Themeable2, ClipboardButton, DataLinkButton, IconButton } from '@grafana/ui'; @@ -23,6 +23,7 @@ export interface Props extends Themeable2 { onClickShowDetectedField?: (key: string) => void; onClickHideDetectedField?: (key: string) => void; row: LogRowModel; + app?: CoreApp; } interface State { @@ -115,7 +116,7 @@ class UnThemedLogDetailsRow extends PureComponent { }; showStats = () => { - const { getStats, isLabel, row } = this.props; + const { getStats, isLabel, row, app } = this.props; const { showFieldsStats } = this.state; if (!showFieldsStats) { const fieldStats = getStats(); @@ -129,6 +130,7 @@ class UnThemedLogDetailsRow extends PureComponent { fieldType: isLabel ? 'label' : 'detectedField', type: showFieldsStats ? 'close' : 'open', logRowUid: row.uid, + app, }); }; diff --git a/public/app/features/logs/components/LogRow.tsx b/public/app/features/logs/components/LogRow.tsx index 2d65bb0b63f..e801364a112 100644 --- a/public/app/features/logs/components/LogRow.tsx +++ b/public/app/features/logs/components/LogRow.tsx @@ -250,6 +250,7 @@ class UnThemedLogRow extends PureComponent { wrapLogMessage={wrapLogMessage} hasError={hasError} showDetectedFields={showDetectedFields} + app={app} /> )}