Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

sentry: Do some basic URL client-side aggregation.

Alex Vandiver768ab19cd399
diff --git a/web/src/sentry.ts b/web/src/sentry.ts
index 8e7a2457f88..f1c3c108b6e 100644
--- a/web/src/sentry.ts
+++ b/web/src/sentry.ts
@@ -9,6 +9,19 @@ type UserInfo = {
role?: string;
};
+export function normalize_path(path: string, is_portico = false): string {
+ path = path
+ .replace(/\/\d+(\/|$)/, "/*$1")
+ .replace(
+ /^\/(join|reactivate|new|accounts\/do_confirm|accounts\/confirm_new_email)\/[^/]+(\/?)$/,
+ "$1/*$2",
+ );
+ if (is_portico) {
+ return "portico: " + path;
+ }
+ return path;
+}
+
if (page_params.server_sentry_dsn) {
const url_matches = [/^\//, new RegExp("^" + _.escapeRegExp(page_params.webpack_public_path))];
if (page_params.realm_uri !== undefined) {
@@ -52,6 +65,13 @@ if (page_params.server_sentry_dsn) {
integrations: [
new Sentry.BrowserTracing({
tracePropagationTargets: url_matches,
+ beforeNavigate(context) {
+ return {
+ ...context,
+ metadata: {source: "custom"},
+ name: normalize_path(location.pathname, sentry_key === "www"),
+ };
+ },
}),
],
allowUrls: url_matches,