mirror of
https://github.com/grafana/grafana.git
synced 2025-01-16 11:42:35 -06:00
LokiContext: Add feature tracking (#62344)
* add feature tracking to LokiContextUi * only depend on `row.uid` Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com> --------- Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
parent
38d7168921
commit
d7026900bd
@ -4,6 +4,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { useAsync } from 'react-use';
|
||||
|
||||
import { GrafanaTheme2, LogRowModel, SelectableValue } from '@grafana/data';
|
||||
import { reportInteraction } from '@grafana/runtime';
|
||||
import { MultiSelect, Tag, Tooltip, useStyles2 } from '@grafana/ui';
|
||||
|
||||
import LokiLanguageProvider from '../LanguageProvider';
|
||||
@ -102,6 +103,20 @@ export function LokiContextUi(props: LokiContextUiProps) {
|
||||
setInitialized(true);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_loaded', {
|
||||
logRowUid: row.uid,
|
||||
type: 'load',
|
||||
});
|
||||
|
||||
return () => {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_loaded', {
|
||||
logRowUid: row.uid,
|
||||
type: 'unload',
|
||||
});
|
||||
};
|
||||
}, [row.uid]);
|
||||
|
||||
const realLabels = contextFilters.filter(({ fromParser }) => !fromParser);
|
||||
const realLabelsEnabled = realLabels.filter(({ enabled }) => enabled);
|
||||
|
||||
@ -141,7 +156,21 @@ export function LokiContextUi(props: LokiContextUiProps) {
|
||||
maxMenuHeight={200}
|
||||
menuShouldPortal={false}
|
||||
noOptionsMessage="No further labels available"
|
||||
onChange={(keys) => {
|
||||
onChange={(keys, actionMeta) => {
|
||||
if (actionMeta.action === 'select-option') {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_filtered', {
|
||||
logRowUid: row.uid,
|
||||
type: 'label',
|
||||
action: 'select',
|
||||
});
|
||||
}
|
||||
if (actionMeta.action === 'remove-value') {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_filtered', {
|
||||
logRowUid: row.uid,
|
||||
type: 'label',
|
||||
action: 'remove',
|
||||
});
|
||||
}
|
||||
return setContextFilters(
|
||||
contextFilters.map((filter) => {
|
||||
if (filter.fromParser) {
|
||||
@ -167,7 +196,21 @@ export function LokiContextUi(props: LokiContextUiProps) {
|
||||
maxMenuHeight={200}
|
||||
noOptionsMessage="No further labels available"
|
||||
isClearable={true}
|
||||
onChange={(keys) => {
|
||||
onChange={(keys, actionMeta) => {
|
||||
if (actionMeta.action === 'select-option') {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_filtered', {
|
||||
logRowUid: row.uid,
|
||||
type: 'parsed_label',
|
||||
action: 'select',
|
||||
});
|
||||
}
|
||||
if (actionMeta.action === 'remove-value') {
|
||||
reportInteraction('grafana_explore_logs_loki_log_context_filtered', {
|
||||
logRowUid: row.uid,
|
||||
type: 'parsed_label',
|
||||
action: 'remove',
|
||||
});
|
||||
}
|
||||
setContextFilters(
|
||||
contextFilters.map((filter) => {
|
||||
if (!filter.fromParser) {
|
||||
|
Loading…
Reference in New Issue
Block a user