mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* FrontendMetrics: Adds new backend api that frontend can use to push frontend measurements and counters to prometheus * FrontendMetrics: Adds new backend api that frontend can use to push frontend measurements and counters to prometheus * Fix naming * change to histogram * Fixed go lint
18 lines
605 B
TypeScript
18 lines
605 B
TypeScript
import { getEchoSrv, EchoEventType } from '@grafana/runtime';
|
|
import { captureException } from '@sentry/browser';
|
|
import { PerformanceEvent } from './backends/PerformanceBackend';
|
|
|
|
export const reportPerformance = (metric: string, value: number) => {
|
|
getEchoSrv().addEvent<PerformanceEvent>({
|
|
type: EchoEventType.Performance,
|
|
payload: {
|
|
name: metric,
|
|
value: value,
|
|
},
|
|
});
|
|
};
|
|
|
|
// Sentry will process the error, adding it's own metadata, applying any sampling rules,
|
|
// then push it to EchoSrv as SentryEvent
|
|
export const reportError = (error: Error) => captureException(error);
|