diff --git a/client/src/app/addons/sentry.ts b/client/src/app/addons/sentry.ts index 26fbd8e49ac..1e8aa08a942 100644 --- a/client/src/app/addons/sentry.ts +++ b/client/src/app/addons/sentry.ts @@ -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) { diff --git a/doc/source/admin/galaxy_options.rst b/doc/source/admin/galaxy_options.rst index 45261c0f195..2cff18ad9e6 100644 --- a/doc/source/admin/galaxy_options.rst +++ b/doc/source/admin/galaxy_options.rst @@ -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`` ~~~~~~~~~~~~~~~~~~~ diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index c0cf9e47245..24c5a9238ae 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -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. diff --git a/lib/galaxy/config/schemas/config_schema.yml b/lib/galaxy/config/schemas/config_schema.yml index d6d3e027f64..6b8a553782c 100644 --- a/lib/galaxy/config/schemas/config_schema.yml +++ b/lib/galaxy/config/schemas/config_schema.yml @@ -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 diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index 192c7d56725..bf49cce94d5 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -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), }