From b0cb02568a6cc252a42f46510b1f0a14b36ebdaa Mon Sep 17 00:00:00 2001 From: Gareth Dawson Date: Thu, 13 Oct 2022 11:21:17 +0100 Subject: [PATCH] Logs: Add feature tracking for filters in log rows (#56808) * Add feature tracking for log details filter clicks * use deconstructed prop values * use deconstructed prop values --- .../logs/components/LogDetailsRow.tsx | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/public/app/features/logs/components/LogDetailsRow.tsx b/public/app/features/logs/components/LogDetailsRow.tsx index 98ab07c4404..3ea32ef13b5 100644 --- a/public/app/features/logs/components/LogDetailsRow.tsx +++ b/public/app/features/logs/components/LogDetailsRow.tsx @@ -89,33 +89,46 @@ class UnThemedLogDetailsRow extends PureComponent { }; filterLabel = () => { - const { onClickFilterLabel, parsedKey, parsedValue } = this.props; + const { onClickFilterLabel, parsedKey, parsedValue, row } = this.props; if (onClickFilterLabel) { onClickFilterLabel(parsedKey, parsedValue); } + + reportInteraction('grafana_explore_logs_log_details_filter_clicked', { + datasourceType: row.datasourceType, + filterType: 'include', + logRowUid: row.uid, + }); }; filterOutLabel = () => { - const { onClickFilterOutLabel, parsedKey, parsedValue } = this.props; + const { onClickFilterOutLabel, parsedKey, parsedValue, row } = this.props; if (onClickFilterOutLabel) { onClickFilterOutLabel(parsedKey, parsedValue); } + + reportInteraction('grafana_explore_logs_log_details_filter_clicked', { + datasourceType: row.datasourceType, + filterType: 'exclude', + logRowUid: row.uid, + }); }; showStats = () => { + const { getStats, isLabel, row } = this.props; const { showFieldsStats } = this.state; if (!showFieldsStats) { - const fieldStats = this.props.getStats(); + const fieldStats = getStats(); const fieldCount = fieldStats ? fieldStats.reduce((sum, stat) => sum + stat.count, 0) : 0; this.setState({ fieldStats, fieldCount }); } this.toggleFieldsStats(); reportInteraction('grafana_explore_logs_log_details_stats_clicked', { - dataSourceType: this.props.row.datasourceType, - fieldType: this.props.isLabel ? 'label' : 'detectedField', + dataSourceType: row.datasourceType, + fieldType: isLabel ? 'label' : 'detectedField', type: showFieldsStats ? 'close' : 'open', - logRowUid: this.props.row.uid, + logRowUid: row.uid, }); };