Prometheus: report metrics browser toggle click interaction (#54546)

* report metrics browser toggle click interaction

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
Galen Kistler 2022-08-31 14:43:00 -05:00 committed by GitHub
parent dd38ff7cc8
commit d19a125ada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,15 +2,16 @@ import { LanguageMap, languages as prismLanguages } from 'prismjs';
import React, { ReactNode } from 'react';
import { Plugin } from 'slate';
import { QueryEditorProps, QueryHint, isDataFrame, toLegacyResponseData, TimeRange, CoreApp } from '@grafana/data';
import { CoreApp, isDataFrame, QueryEditorProps, QueryHint, TimeRange, toLegacyResponseData } from '@grafana/data';
import { reportInteraction } from '@grafana/runtime/src';
import {
SlatePrism,
TypeaheadInput,
TypeaheadOutput,
BracesPlugin,
DOMUtil,
SuggestionsState,
Icon,
SlatePrism,
SuggestionsState,
TypeaheadInput,
TypeaheadOutput,
} from '@grafana/ui';
import { LocalStorageValueProvider } from 'app/core/components/LocalStorageValueProvider';
import {
@ -21,7 +22,7 @@ import {
import { PrometheusDatasource } from '../datasource';
import { roundMsToMin } from '../language_utils';
import { PromQuery, PromOptions } from '../types';
import { PromOptions, PromQuery } from '../types';
import { PrometheusMetricsBrowser } from './PrometheusMetricsBrowser';
import { MonacoQueryFieldWrapper } from './monaco-query-field/MonacoQueryFieldWrapper';
@ -219,6 +220,11 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
onClickChooserButton = () => {
this.setState((state) => ({ labelBrowserVisible: !state.labelBrowserVisible }));
reportInteraction('user_grafana_prometheus_metrics_browser_clicked', {
editorMode: this.state.labelBrowserVisible ? 'metricViewClosed' : 'metricViewOpen',
app: this.props?.app ?? '',
});
};
onClickHintFix = () => {