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
This commit is contained in:
Gareth Dawson 2022-10-13 11:21:17 +01:00 committed by GitHub
parent b71e08ad59
commit b0cb02568a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,33 +89,46 @@ class UnThemedLogDetailsRow extends PureComponent<Props, State> {
};
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,
});
};