-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sentry: Extract functions used by channel into a util file.
This is to make tests for channel work. Channel mocks `$` to be an object, so it cannot be called as an function in sentry.ts if it is imported in channel.ts. So, to avoid it, we extract the functions which channel.ts uses and fortunately they don't use `$`, so it works out.
- Loading branch information
Showing
4 changed files
with
28 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export function normalize_path(path: string, is_portico = false): string { | ||
if (path === undefined) { | ||
return "unknown"; | ||
} | ||
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; | ||
} | ||
|
||
export function shouldCreateSpanForRequest(url: string): boolean { | ||
const parsed = new URL(url, window.location.href); | ||
return parsed.pathname !== "/json/events"; | ||
} |