Add sentry_client_traces_sample_rate for client-side performance tracing

Separate from the server-side sentry_traces_sample_rate so admins can
independently control browser performance trace sampling. Defaults to 0
(no client performance traces).
This commit is contained in:
Dannon Baker
2026-03-23 12:35:51 -04:00
parent f78dd12d9e
commit 71de8f565f
5 changed files with 33 additions and 2 deletions
+3 -2
View File
@@ -1,10 +1,10 @@
import type { Integration } from "@sentry/core";
import * as Sentry from "@sentry/vue";
import Vue from "vue";
import type VueRouter from "vue-router";
interface GalaxyConfig {
sentry_dsn_public?: string;
sentry_client_traces_sample_rate?: number;
version_major: string;
version_minor?: string;
}
@@ -50,7 +50,7 @@ export function initSentry(Galaxy: GalaxyInstance, router: VueRouter): void {
}
const replayEnabled = isReplayEnabled(Galaxy.user);
const integrations: Integration[] = [Sentry.browserTracingIntegration({ router })];
const integrations = [Sentry.browserTracingIntegration({ router })];
if (replayEnabled) {
integrations.push(
Sentry.replayIntegration({
@@ -65,6 +65,7 @@ export function initSentry(Galaxy: GalaxyInstance, router: VueRouter): void {
dsn: config.sentry_dsn_public,
integrations,
release,
tracesSampleRate: config.sentry_client_traces_sample_rate ?? 0,
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: replayEnabled ? 1.0 : 0,
beforeSend(event, hint) {
+13
View File
@@ -3300,6 +3300,19 @@
:Type: float
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``sentry_client_traces_sample_rate``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Sample rate for client-side (browser) performance tracing, between
0 and 1. Controls what fraction of page loads and navigations
generate performance traces sent to Sentry. Independent of
sentry_traces_sample_rate, which controls server-side tracing.
:Default: ``0.0``
:Type: float
~~~~~~~~~~~~~~~~~~~
``sentry_ca_certs``
~~~~~~~~~~~~~~~~~~~
@@ -1911,6 +1911,12 @@ galaxy:
# to Sentry. A value higher than 0 is required to analyze performance.
#sentry_traces_sample_rate: 0.0
# Sample rate for client-side (browser) performance tracing, between 0
# and 1. Controls what fraction of page loads and navigations generate
# performance traces sent to Sentry. Independent of
# sentry_traces_sample_rate, which controls server-side tracing.
#sentry_client_traces_sample_rate: 0.0
# Use this option to provide the path to location of the CA
# (Certificate Authority) certificate file if the sentry server uses a
# self-signed certificate.
@@ -2431,6 +2431,16 @@ mapping:
will have that percentage chance of being sent to Sentry. A value higher than 0
is required to analyze performance.
sentry_client_traces_sample_rate:
type: float
default: 0.0
required: false
desc: |
Sample rate for client-side (browser) performance tracing, between 0
and 1. Controls what fraction of page loads and navigations generate
performance traces sent to Sentry. Independent of
sentry_traces_sample_rate, which controls server-side tracing.
sentry_ca_certs:
type: str
required: False
+1
View File
@@ -245,6 +245,7 @@ class ConfigSerializer(base.ModelSerializer):
"install_resolver_dependencies": _use_config,
"enable_tool_generated_tours": _use_config,
"sentry_dsn_public": lambda item, key, **context: item.sentry_dsn_public,
"sentry_client_traces_sample_rate": _use_config,
"enable_webhooks": lambda item, key, **context: hasattr(self.app, "webhooks_registry")
and bool(self.app.webhooks_registry.webhooks),
}