mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
sentry: Better URL filtering.
Always add `webpack_public_path` to all of the URL filters, and make it a regex. Also adjust to respect undef realm_uri, such as when a spectator.
This commit is contained in:
committed by
Tim Abbott
parent
dfb9f74017
commit
cd288af4d5
@@ -12,7 +12,10 @@ type UserInfo = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (page_params.server_sentry_dsn) {
|
if (page_params.server_sentry_dsn) {
|
||||||
const url_regex = new RegExp("^" + _.escapeRegExp(page_params.realm_uri) + "/");
|
const url_matches = [/^\//, new RegExp("^" + _.escapeRegExp(page_params.webpack_public_path))];
|
||||||
|
if (page_params.realm_uri !== undefined) {
|
||||||
|
url_matches.push(new RegExp("^" + _.escapeRegExp(page_params.realm_uri) + "/"));
|
||||||
|
}
|
||||||
const user_info: UserInfo = {
|
const user_info: UserInfo = {
|
||||||
realm: page_params.realm_sentry_key!,
|
realm: page_params.realm_sentry_key!,
|
||||||
role: page_params.is_owner
|
role: page_params.is_owner
|
||||||
@@ -38,14 +41,14 @@ if (page_params.server_sentry_dsn) {
|
|||||||
release: "zulip-server@" + ZULIP_VERSION,
|
release: "zulip-server@" + ZULIP_VERSION,
|
||||||
integrations: [
|
integrations: [
|
||||||
new BrowserTracing({
|
new BrowserTracing({
|
||||||
tracePropagationTargets: [url_regex],
|
tracePropagationTargets: url_matches,
|
||||||
}),
|
}),
|
||||||
new HttpClientIntegration({
|
new HttpClientIntegration({
|
||||||
failedRequestStatusCodes: [500, 502, 503, 504],
|
failedRequestStatusCodes: [500, 502, 503, 504],
|
||||||
failedRequestTargets: [url_regex],
|
failedRequestTargets: url_matches,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
allowUrls: [url_regex, page_params.webpack_public_path],
|
allowUrls: url_matches,
|
||||||
sampleRate: page_params.server_sentry_sample_rate || 0,
|
sampleRate: page_params.server_sentry_sample_rate || 0,
|
||||||
tracesSampleRate: page_params.server_sentry_trace_rate || 0,
|
tracesSampleRate: page_params.server_sentry_trace_rate || 0,
|
||||||
initialScope: {
|
initialScope: {
|
||||||
|
|||||||
Reference in New Issue
Block a user