root: set additional sentry tags
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2cde40aeee
commit
c55f2ad10a
|
@ -20,6 +20,7 @@ from time import time
|
||||||
import structlog
|
import structlog
|
||||||
from celery.schedules import crontab
|
from celery.schedules import crontab
|
||||||
from sentry_sdk import init as sentry_init
|
from sentry_sdk import init as sentry_init
|
||||||
|
from sentry_sdk.api import set_tag
|
||||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
from sentry_sdk.integrations.redis import RedisIntegration
|
from sentry_sdk.integrations.redis import RedisIntegration
|
||||||
|
@ -354,6 +355,11 @@ if _ERROR_REPORTING:
|
||||||
environment=CONFIG.y("error_reporting.environment", "customer"),
|
environment=CONFIG.y("error_reporting.environment", "customer"),
|
||||||
send_default_pii=CONFIG.y_bool("error_reporting.send_pii", False),
|
send_default_pii=CONFIG.y_bool("error_reporting.send_pii", False),
|
||||||
)
|
)
|
||||||
|
set_tag("authentik:build_hash", os.environ.get(ENV_GIT_HASH_KEY, ""))
|
||||||
|
set_tag(
|
||||||
|
"authentik:env", "kubernetes" if "KUBERNETES_PORT" in os.environ else "compose"
|
||||||
|
)
|
||||||
|
set_tag("authentik:component", "backend")
|
||||||
j_print(
|
j_print(
|
||||||
"Error reporting is enabled",
|
"Error reporting is enabled",
|
||||||
env=CONFIG.y("error_reporting.environment", "customer"),
|
env=CONFIG.y("error_reporting.environment", "customer"),
|
||||||
|
|
|
@ -6,7 +6,9 @@ import { me } from "./Users";
|
||||||
import { config } from "./Config";
|
import { config } from "./Config";
|
||||||
import { Config } from "authentik-api";
|
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) => {
|
return config().then((config) => {
|
||||||
if (config.errorReportingEnabled) {
|
if (config.errorReportingEnabled) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
|
@ -51,6 +53,12 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
|
||||||
return event;
|
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.");
|
console.debug("authentik/config: Sentry enabled.");
|
||||||
if (config.errorReportingSendPii && canDoPpi) {
|
if (config.errorReportingSendPii && canDoPpi) {
|
||||||
me().then(user => {
|
me().then(user => {
|
||||||
|
|
Reference in a new issue