grafana/public/app/plugins/datasource/loki/module.ts
Ivana Huckova fdc3adb2c9
Loki: Add tracking for on dashboard load (#59914)
Loki: Add on dashboard load tracking
2022-12-06 21:15:55 +01:00

18 lines
809 B
TypeScript

import { DashboardLoadedEvent, DataSourcePlugin } from '@grafana/data';
import { getAppEvents } from '@grafana/runtime';
import LokiCheatSheet from './components/LokiCheatSheet';
import LokiQueryEditorByApp from './components/LokiQueryEditorByApp';
import { ConfigEditor } from './configuration/ConfigEditor';
import { LokiDatasource } from './datasource';
import { onDashboardLoadedHandler } from './tracking';
import { LokiQuery } from './types';
export const plugin = new DataSourcePlugin(LokiDatasource)
.setQueryEditor(LokiQueryEditorByApp)
.setConfigEditor(ConfigEditor)
.setQueryEditorHelp(LokiCheatSheet);
// Subscribe to on dashboard loaded event so that we can track plugin adoption
getAppEvents().subscribe<DashboardLoadedEvent<LokiQuery>>(DashboardLoadedEvent, onDashboardLoadedHandler);