dd7409dcb2
* basic raygun setup * testing seq logging * minor fixes * more accurate user identification * logrocket adjustments * speedcurve seems to work? * added debugbear * minor cleanup * chore(helm chart): adds new web app analytics ids/keys to fe2 env vars - assumes none are secrets * Quote all secrets to prevent interpretation as digits --------- Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
36 lines
757 B
TypeScript
36 lines
757 B
TypeScript
/**
|
|
* Sending SSR request health metrics to the logger
|
|
*/
|
|
export default defineNuxtPlugin((ctx) => {
|
|
const router = useRouter()
|
|
const logger = useLogger()
|
|
|
|
const path = router.currentRoute.value?.matched?.[0]?.path || 'empty'
|
|
const name = router.currentRoute.value?.name || 'empty'
|
|
|
|
const state = {
|
|
start: Date.now(),
|
|
path: `${String(name)}: ${path}`
|
|
}
|
|
|
|
logger.debug(
|
|
{
|
|
routeName: name,
|
|
routePath: path
|
|
},
|
|
'{routePath} SSR render started...'
|
|
)
|
|
|
|
ctx.hook('app:rendered', () => {
|
|
const endTime = Date.now() - state.start
|
|
logger.info(
|
|
{
|
|
responseTime: endTime,
|
|
routeName: name,
|
|
routePath: path
|
|
},
|
|
'{routePath} SSR rendered in {responseTime} ms'
|
|
)
|
|
})
|
|
})
|