Logs: add app to feature tracking in ad-hoc statistics (#56865)

* add app tracking to adhoc statistics

* use the object property value shorthand
This commit is contained in:
Gareth Dawson 2022-10-13 14:26:59 +01:00 committed by GitHub
parent 83aa006c98
commit b8b25f7e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -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<Props> {
render() {
const {
app,
row,
theme,
hasError,
@ -110,6 +112,7 @@ class UnThemedLogDetails extends PureComponent<Props> {
onClickFilterOutLabel={onClickFilterOutLabel}
onClickFilterLabel={onClickFilterLabel}
row={row}
app={app}
/>
);
})}
@ -148,6 +151,7 @@ class UnThemedLogDetails extends PureComponent<Props> {
showDetectedFields={showDetectedFields}
wrapLogMessage={wrapLogMessage}
row={row}
app={app}
/>
);
})}

View File

@ -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<Props, State> {
};
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<Props, State> {
fieldType: isLabel ? 'label' : 'detectedField',
type: showFieldsStats ? 'close' : 'open',
logRowUid: row.uid,
app,
});
};

View File

@ -250,6 +250,7 @@ class UnThemedLogRow extends PureComponent<Props, State> {
wrapLogMessage={wrapLogMessage}
hasError={hasError}
showDetectedFields={showDetectedFields}
app={app}
/>
)}
</>