Faro & grafana improvements
This commit is contained in:
@@ -17,6 +17,11 @@ import { TracingInstrumentation } from '@grafana/faro-web-tracing';
|
||||
import { OtlpHttpTransport } from '@grafana/faro-transport-otlp-http';
|
||||
|
||||
let initialized = false;
|
||||
let faroApi = null;
|
||||
|
||||
export function getFaro() {
|
||||
return faroApi;
|
||||
}
|
||||
|
||||
export function initFaro() {
|
||||
if (initialized) return;
|
||||
@@ -34,7 +39,7 @@ export function initFaro() {
|
||||
const version = import.meta.env.VITE_FARO_APP_VERSION || '1.0.0';
|
||||
|
||||
try {
|
||||
initializeFaro({
|
||||
const faro = initializeFaro({
|
||||
url: `${endpoint.replace(/\/$/, '')}/v1/traces`,
|
||||
app: {
|
||||
name: appName,
|
||||
@@ -61,6 +66,9 @@ export function initFaro() {
|
||||
url: `${endpoint.replace(/\/$/, '')}/v1/traces`,
|
||||
}),
|
||||
});
|
||||
faroApi = faro.api;
|
||||
// Expose for ErrorBoundary and manual reporting
|
||||
window.__faro = faro;
|
||||
} catch (err) {
|
||||
// Never let Faro init failure break the app.
|
||||
// eslint-disable-next-line no-console
|
||||
|
||||
Reference in New Issue
Block a user