web: send sentry-trace header in API requests
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
29241cc287
commit
141481df3a
|
@ -3,6 +3,7 @@ import { getCookie } from "../utils";
|
|||
import { APIMiddleware } from "../elements/notifications/APIDrawer";
|
||||
import { MessageMiddleware } from "../elements/messages/Middleware";
|
||||
import { VERSION } from "../constants";
|
||||
import { getMetaContent } from "@sentry/tracing/dist/browser/browsertracing";
|
||||
|
||||
export class LoggingMiddleware implements Middleware {
|
||||
|
||||
|
@ -53,6 +54,7 @@ export const DEFAULT_CONFIG = new Configuration({
|
|||
basePath: process.env.AK_API_BASE_PATH + "/api/v3",
|
||||
headers: {
|
||||
"X-CSRFToken": getCookie("authentik_csrf"),
|
||||
"sentry-trace": getMetaContent("sentry-trace") || "",
|
||||
},
|
||||
middleware: [
|
||||
new APIMiddleware(),
|
||||
|
|
|
@ -27,7 +27,10 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
|
|||
],
|
||||
tracesSampleRate: config.errorReporting.tracesSampleRate,
|
||||
environment: config.errorReporting.environment,
|
||||
beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint): Promise<Sentry.Event | null> => {
|
||||
beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint | undefined): Promise<Sentry.Event | null> => {
|
||||
if (!hint) {
|
||||
return event;
|
||||
}
|
||||
if (hint.originalException instanceof SentryIgnoredError) {
|
||||
return null;
|
||||
}
|
||||
|
|
Reference in New Issue