mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
18 lines
561 B
TypeScript
18 lines
561 B
TypeScript
import { faro } from '@grafana/faro-web-sdk';
|
|
import { getEchoSrv, EchoEventType } from '@grafana/runtime';
|
|
|
|
import { PerformanceEvent } from './backends/PerformanceBackend';
|
|
|
|
export const reportPerformance = (metric: string, value: number) => {
|
|
getEchoSrv().addEvent<PerformanceEvent>({
|
|
type: EchoEventType.Performance,
|
|
payload: {
|
|
name: metric,
|
|
value: value,
|
|
},
|
|
});
|
|
};
|
|
|
|
// Farp will process the error, then push it to EchoSrv as GrafanaJavascriptAgent event
|
|
export const reportError = (error: Error) => faro?.api?.pushError(error);
|