root: set additional sentry tags

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-05-15 19:53:43 +02:00
parent 2cde40aeee
commit c55f2ad10a
2 changed files with 15 additions and 1 deletions

View File

@ -6,7 +6,9 @@ import { me } from "./Users";
import { config } from "./Config";
import { Config } from "authentik-api";
export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
export const TAG_SENTRY_COMPONENT = "authentik:component";
export function configureSentry(canDoPpi: boolean = false, tags: { [key: string]: string; } = {}): Promise<Config> {
return config().then((config) => {
if (config.errorReportingEnabled) {
Sentry.init({
@ -51,6 +53,12 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
return event;
},
});
Sentry.setTags(tags);
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}`);
}
console.debug("authentik/config: Sentry enabled.");
if (config.errorReportingSendPii && canDoPpi) {
me().then(user => {