Use sentry-fastapi integration, expose sampling rate

This commit is contained in:
mvdbeek
2023-02-10 13:03:09 +01:00
parent 45c0701885
commit a31eb0489c
10 changed files with 47 additions and 21 deletions
+16 -2
View File
@@ -2914,6 +2914,19 @@
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``sentry_traces_sample_rate``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Set to a number between 0 and 1. With this option set, every
transaction created will have that percentage chance of being sent
to Sentry. A value higher than 0 is required to analyze
performance.
:Default: ``0.0``
:Type: float
~~~~~~~~~~~~~~~
``statsd_host``
~~~~~~~~~~~~~~~
@@ -5076,14 +5089,15 @@
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``enable_beacon_integration``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Enables user preferences and api endpoint for the beacon integration.
Enables user preferences and api endpoint for the beacon
integration.
:Default: ``false``
:Type: bool
+1
View File
@@ -202,6 +202,7 @@ class SentryClientMixin:
self.config.sentry_dsn,
release=f"{self.config.version_major}.{self.config.version_minor}",
integrations=[sentry_logging],
traces_sample_rate=self.config.sentry_traces_sample_rate,
)
self.application_stack.register_postfork_function(postfork_sentry_client)
@@ -1667,6 +1667,11 @@ galaxy:
# Sentry. Possible values are DEBUG, INFO, WARNING, ERROR or CRITICAL.
#sentry_event_level: ERROR
# Set to a number between 0 and 1. With this option set, every
# transaction created will have that percentage chance of being sent
# to Sentry. A value higher than 0 is required to analyze performance.
#sentry_traces_sample_rate: 0.0
# Log to statsd Statsd is an external statistics aggregator
# (https://github.com/etsy/statsd) Enabling the following options will
# cause galaxy to log request timing and other statistics to the
@@ -311,6 +311,11 @@ tool_shed:
# Sentry. Possible values are DEBUG, INFO, WARNING, ERROR or CRITICAL.
#sentry_event_level: ERROR
# Set to a number between 0 and 1. With this option set, every
# transaction created will have that percentage chance of being sent
# to Sentry. A value higher than 0 is required to analyze performance.
#sentry_traces_sample_rate: 0.0
# Galaxy Session Timeout This provides a timeout (in minutes) after
# which a user will have to log back in. A duration of 0 disables this
# feature.
@@ -2108,6 +2108,15 @@ mapping:
Determines the minimum log level that will be sent as an event to Sentry.
Possible values are DEBUG, INFO, WARNING, ERROR or CRITICAL.
sentry_traces_sample_rate:
type: float
default: 0.0
required: false
desc: |
Set to a number between 0 and 1. With this option set, every transaction created
will have that percentage chance of being sent to Sentry. A value higher than 0
is required to analyze performance.
statsd_host:
type: str
required: false
@@ -557,6 +557,15 @@ mapping:
Determines the minimum log level that will be sent as an event to Sentry.
Possible values are DEBUG, INFO, WARNING, ERROR or CRITICAL.
sentry_traces_sample_rate:
type: float
default: 0.0
required: false
desc: |
Set to a number between 0 and 1. With this option set, every transaction created
will have that percentage chance of being sent to Sentry. A value higher than 0
is required to analyze performance.
session_duration:
type: int
default: 0
@@ -2,7 +2,7 @@
psycopg2-binary==2.9.5
mysqlclient
fluent-logger
sentry-sdk
sentry-sdk[fastapi]
pbs_python
drmaa
statsd
+1 -6
View File
@@ -66,6 +66,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs):
# Call app's shutdown method when the interpeter exits, this cleanly stops
# the various Galaxy application daemon threads
app.application_stack.register_postfork_function(atexit.register, app.shutdown)
# Create the universe WSGI application
webapp = GalaxyWebApplication(app, session_cookie="galaxysession", name="galaxy")
@@ -1304,13 +1305,7 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf):
from paste import recursive
app = wrap_if_allowed(app, stack, recursive.RecursiveMiddleware, args=(conf,))
# If sentry logging is enabled, log here before propogating up to
# the error middleware
sentry_dsn = conf.get("sentry_dsn", None)
if sentry_dsn:
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
app = wrap_if_allowed(app, stack, SentryWsgiMiddleware)
# Error middleware
app = wrap_if_allowed(app, stack, ErrorMiddleware, args=(conf,))
# Transaction logging (apache access.log style)
-5
View File
@@ -107,11 +107,6 @@ def add_galaxy_middleware(app: FastAPI, gx_app):
GalaxyFileResponse.nginx_x_accel_redirect_base = gx_app.config.nginx_x_accel_redirect_base
GalaxyFileResponse.apache_xsendfile = gx_app.config.apache_xsendfile
if gx_app.config.sentry_dsn:
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
app.add_middleware(SentryAsgiMiddleware)
if gx_app.config.get("allowed_origin_hostnames", None):
app.add_middleware(
GalaxyCORSMiddleware,
-7
View File
@@ -267,14 +267,7 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf):
from paste.translogger import TransLogger
app = wrap_if_allowed(app, stack, TransLogger)
# If sentry logging is enabled, log here before propogating up to
# the error middleware
# TODO sentry config is duplicated between tool_shed/galaxy, refactor this.
sentry_dsn = conf.get("sentry_dsn", None)
if sentry_dsn:
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
app = wrap_if_allowed(app, stack, SentryWsgiMiddleware)
# X-Forwarded-Host handling
from galaxy.web.framework.middleware.xforwardedhost import XForwardedHostMiddleware