From 0544dc3f8360ba3c196e6e5f70c427938aa1bca7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 13 Dec 2021 21:03:30 +0100 Subject: [PATCH] web: use correct transaction names for web Signed-off-by: Jens Langhammer --- web/src/api/Sentry.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/api/Sentry.ts b/web/src/api/Sentry.ts index 4761d5524..11990cf00 100644 --- a/web/src/api/Sentry.ts +++ b/web/src/api/Sentry.ts @@ -43,8 +43,13 @@ export function configureSentry(canDoPpi: boolean = false): Promise { Sentry.setTag(TAG_SENTRY_CAPABILITIES, config.capabilities.join(",")); if (window.location.pathname.includes("if/")) { // Get the interface name from URL - const intf = window.location.pathname.replace(/.+if\/(.+)\//, "$1"); - Sentry.setTag(TAG_SENTRY_COMPONENT, `web/${intf}`); + const pathMatches = window.location.pathname.match(/.+if\/(\w+)\//); + let currentInterface = "unkown"; + if (pathMatches && pathMatches.length >= 2) { + currentInterface = pathMatches[1]; + } + Sentry.setTag(TAG_SENTRY_COMPONENT, `web/${currentInterface}`); + Sentry.configureScope((scope) => scope.setTransactionName(`authentik.web.if.${currentInterface}`)); } if (config.errorReporting.sendPii && canDoPpi) { me().then(user => {