Skip to content

Commit

Permalink
Merge pull request #1417 from dandi/sentry-perf-rate
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna authored Jan 9, 2023
2 parents 57e2bbe + 2f1df1f commit e18c616
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dandiapi/api/apps.py
Original file line number Diff line number Diff line change
@@ -20,10 +20,11 @@ def _get_sentry_performance_sample_rate(*args, **kwargs) -> float:
from dandiapi.api.models.version import Version

def is_noisy():
# these are 2 noisy routes that we can reduce the sampling size for.
# these are noisy routes that we can reduce the sampling size for.
# TODO: use the django url resolver to avoid redefining regular expressions.
noisy_route_regex = [
f'zarr/{Asset.UUID_REGEX}.zarr/[0-9/]+',
f'assets/{Asset.UUID_REGEX}/download',
(
f'dandisets/{Dandiset.IDENTIFIER_REGEX}/versions/{Version.VERSION_REGEX}/'
'assets/{Asset.UUID_REGEX}'
@@ -33,7 +34,7 @@ def is_noisy():
if len(args) and 'wsgi_environ' in args[0]:
wsgi_environ = args[0]['wsgi_environ']

if wsgi_environ.get('REQUEST_METHOD') == 'GET':
if wsgi_environ.get('REQUEST_METHOD') in ['GET', 'HEAD']:
for route in noisy_route_regex:
if re.search(route, wsgi_environ.get('PATH_INFO', '')):
return True

0 comments on commit e18c616

Please sign in to comment.