mirror of https://github.com/zulip/zulip.git
sentry: Heavily downsample presence spans.
Instead of dropping all of these spans, downsample them heavily (1% of expected sampling rate). These are some of the most frequent requests to the server, and the high volumes do not add much information. We leave a small percent of requests, since it is a useful measure of overall client network latency.
This commit is contained in:
parent
9912b4c815
commit
6a3f97ba80
|
@ -27,7 +27,7 @@ export function normalize_path(path: string, is_portico = false): string {
|
|||
|
||||
export function shouldCreateSpanForRequest(url: string): boolean {
|
||||
const parsed = new URL(url, window.location.href);
|
||||
return !["/json/events", "/json/users/me/presence"].includes(parsed.pathname);
|
||||
return parsed.pathname !== "/json/events";
|
||||
}
|
||||
|
||||
if (page_params.server_sentry_dsn) {
|
||||
|
@ -64,6 +64,13 @@ if (page_params.server_sentry_dsn) {
|
|||
}
|
||||
}
|
||||
|
||||
const sample_rates = new Map([
|
||||
// This is controlled by shouldCreateSpanForRequest, above, but also put here for consistency
|
||||
["call GET /json/events", 0],
|
||||
// These requests are high-volume and do not add much data
|
||||
["call POST /json/users/me/presence", 0.01],
|
||||
]);
|
||||
|
||||
Sentry.init({
|
||||
dsn: page_params.server_sentry_dsn,
|
||||
environment: page_params.server_sentry_environment ?? "development",
|
||||
|
@ -86,7 +93,11 @@ if (page_params.server_sentry_dsn) {
|
|||
],
|
||||
allowUrls: url_matches,
|
||||
sampleRate: page_params.server_sentry_sample_rate ?? 0,
|
||||
tracesSampleRate: page_params.server_sentry_trace_rate ?? 0,
|
||||
tracesSampler(samplingContext) {
|
||||
const base_rate = page_params.server_sentry_trace_rate ?? 0;
|
||||
const name = samplingContext.transactionContext.name;
|
||||
return base_rate * (sample_rates.get(name) ?? 1);
|
||||
},
|
||||
initialScope: {
|
||||
tags: {
|
||||
realm: sentry_key,
|
||||
|
|
Loading…
Reference in New Issue