feat: add i18n support and implement Grafana plugin
Adds internationalization support in filters and origins pages by importing the useI18n function. Expands ESLint configuration to include new rules and plugins, ensuring improved code quality. Introduces Grafana monitoring plugin to enhance performance tracking capabilities in the application.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { FetchTransport, getWebInstrumentations, initializeFaro,InternalLoggerLevel } from '@grafana/faro-web-sdk'
|
||||
import { TracingInstrumentation } from '@grafana/faro-web-tracing'
|
||||
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch'
|
||||
|
||||
import { envConfig } from '~/utils/environment'
|
||||
const config = envConfig(window.location.hostname)
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
if (config.grafanaUrl) {
|
||||
const faro = initializeFaro({
|
||||
app: {
|
||||
name: 'Shiny Frontend',
|
||||
version: '1.0.0',
|
||||
environment: config.name,
|
||||
},
|
||||
sessionTracking: {
|
||||
samplingRate: config.tracesSampleRate,
|
||||
},
|
||||
instrumentations: [
|
||||
// Mandatory, omits default instrumentations otherwise.
|
||||
...getWebInstrumentations(),
|
||||
|
||||
// Tracing package to get end-to-end visibility for HTTP requests.
|
||||
new TracingInstrumentation({
|
||||
instrumentations: [
|
||||
new FetchInstrumentation({
|
||||
ignoreUrls: [
|
||||
config.grafanaUrl,
|
||||
config.apiUrl,
|
||||
new RegExp('.*/sw.js$'),
|
||||
new RegExp('.*_payload.json.*'),
|
||||
new RegExp(`https://${config.auth.domain}/*`),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
internalLoggerLevel: InternalLoggerLevel.VERBOSE,
|
||||
transports: [
|
||||
new FetchTransport({ url: config.grafanaUrl }),
|
||||
],
|
||||
})
|
||||
console.log(`initialized faro for ${config.grafanaUrl}, sample-rate ${config.tracesSampleRate * 100}%`)
|
||||
nuxtApp.provide('faro', faro)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user