Skip to content

Commit 45a2194

Browse files
authored
feat(cells) Add silo annotations to more views/endpoints (#103925)
Add silo annotations to more endpoints/views that didn't have silo assignments defined. Refs INFRENG-201
1 parent 33719b6 commit 45a2194

File tree

15 files changed

+43
-21
lines changed

15 files changed

+43
-21
lines changed

src/sentry/auth/providers/saml2/provider.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def dispatch(self, request: HttpRequest, organization_slug: str) -> HttpResponse
128128
return pipeline.current_step()
129129

130130

131+
@control_silo_view
131132
class SAML2ACSView(AuthView):
132133
@method_decorator(csrf_exempt)
133134
def dispatch(self, request: HttpRequest, pipeline: AuthHelper) -> HttpResponseBase:
@@ -152,6 +153,7 @@ def dispatch(self, request: HttpRequest, pipeline: AuthHelper) -> HttpResponseBa
152153
return pipeline.next_step()
153154

154155

156+
@control_silo_view
155157
class SAML2SLSView(BaseView):
156158
@method_decorator(csrf_exempt)
157159
def dispatch(self, request: HttpRequest, organization_slug: str) -> HttpResponseRedirect:

src/sentry/integrations/web/discord_extension_configuration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from sentry.integrations.types import IntegrationProviderSlug
2+
from sentry.web.frontend.base import control_silo_view
23

34
from .integration_extension_configuration import IntegrationExtensionConfigurationView
45

56

7+
@control_silo_view
68
class DiscordExtensionConfigurationView(IntegrationExtensionConfigurationView):
79
provider = IntegrationProviderSlug.DISCORD.value
810
external_provider_key = IntegrationProviderSlug.DISCORD.value
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
from sentry.web.frontend.base import control_silo_view
2+
13
from .integration_extension_configuration import IntegrationExtensionConfigurationView
24

35

6+
@control_silo_view
47
class VercelExtensionConfigurationView(IntegrationExtensionConfigurationView):
58
provider = "vercel"
69
external_provider_key = "vercel"

src/sentry/web/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
}
6868

6969

70+
@all_silo_view
7071
class ClientConfigView(BaseView):
7172
def get(self, request: Request) -> HttpResponse:
7273
return HttpResponse(json.dumps(get_client_config(request)), content_type="application/json")

src/sentry/web/constants.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FOREVER_CACHE = "max-age=315360000"
2+
3+
# See
4+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#requiring_revalidation
5+
# This means that clients *CAN* cache the resource, but they must revalidate
6+
# before using it This means we will have a small HTTP request overhead to
7+
# verify that the local resource is not outdated
8+
#
9+
# Note that the above docs state that "no-cache" is the same as "max-age=0,
10+
# must-revalidate", but some CDNs will not treat them as the same
11+
NO_CACHE = "max-age=0, must-revalidate"
12+
13+
# no-store means that the response should not be stored in *ANY* cache
14+
NEVER_CACHE = "max-age=0, no-cache, no-store, must-revalidate"

src/sentry/web/frontend/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
from sentry.utils.audit import create_audit_entry
4949
from sentry.utils.auth import construct_link_with_query, is_valid_redirect
5050
from sentry.utils.http import absolute_uri, is_using_customer_domain, origin_from_request
51-
from sentry.web.frontend.generic import FOREVER_CACHE
51+
from sentry.web.constants import FOREVER_CACHE
5252
from sentry.web.helpers import render_to_response
5353
from sudo.views import redirect_to_sudo
5454

src/sentry/web/frontend/generic.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,8 @@
77
from django.http import Http404, HttpResponseNotFound
88
from django.views import static
99

10-
FOREVER_CACHE = "max-age=315360000"
11-
12-
# See
13-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#requiring_revalidation
14-
# This means that clients *CAN* cache the resource, but they must revalidate
15-
# before using it This means we will have a small HTTP request overhead to
16-
# verify that the local resource is not outdated
17-
#
18-
# Note that the above docs state that "no-cache" is the same as "max-age=0,
19-
# must-revalidate", but some CDNs will not treat them as the same
20-
NO_CACHE = "max-age=0, must-revalidate"
21-
22-
# no-store means that the response should not be stored in *ANY* cache
23-
NEVER_CACHE = "max-age=0, no-cache, no-store, must-revalidate"
10+
from sentry.web.constants import FOREVER_CACHE, NEVER_CACHE, NO_CACHE
11+
from sentry.web.frontend.base import all_silo_view
2412

2513

2614
def dev_favicon(request, extension):
@@ -45,6 +33,7 @@ def resolve(path):
4533
return os.path.split(absolute_path)
4634

4735

36+
@all_silo_view
4837
def frontend_app_static_media(request, **kwargs):
4938
"""
5039
Serve static files that should not have any versioned paths/filenames.
@@ -64,6 +53,7 @@ def frontend_app_static_media(request, **kwargs):
6453
return response
6554

6655

56+
@all_silo_view
6757
def static_media(request, **kwargs):
6858
"""
6959
Serve static files below a given point in the directory structure.

src/sentry/web/frontend/pipeline_advancer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
from sentry.integrations.types import IntegrationProviderSlug
1010
from sentry.organizations.absolute_url import generate_organization_url
1111
from sentry.utils.http import absolute_uri, create_redirect_url
12-
from sentry.web.frontend.base import BaseView
12+
from sentry.web.frontend.base import BaseView, all_silo_view
1313

1414
# The request doesn't contain the pipeline type (pipeline information is stored
1515
# in redis keyed by the pipeline name), so we try to construct multiple pipelines
1616
# and use whichever one works.
1717
PIPELINE_CLASSES = (IntegrationPipeline, IdentityPipeline)
1818

1919

20+
@all_silo_view
2021
class PipelineAdvancerView(BaseView):
2122
"""Gets the current pipeline from the request and executes the current step."""
2223

src/social_auth/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from django.utils.http import url_has_allowed_host_and_scheme
1515
from django.views.decorators.csrf import csrf_exempt
1616

17+
from sentry.web.frontend.base import control_silo_view
1718
from social_auth.decorators import dsa_view
1819
from social_auth.exceptions import AuthException
1920
from social_auth.utils import backend_setting, clean_partial_pipeline, setting
@@ -23,6 +24,7 @@
2324
PIPELINE_KEY = setting("SOCIAL_AUTH_PARTIAL_PIPELINE_KEY", "partial_pipeline")
2425

2526

27+
@control_silo_view
2628
@dsa_view(setting("SOCIAL_AUTH_COMPLETE_URL_NAME", "socialauth_associate_complete_auth_sso"))
2729
def auth(request, backend):
2830
"""Authenticate using social backend"""
@@ -53,6 +55,7 @@ def auth(request, backend):
5355
return HttpResponse(backend.auth_html(), content_type="text/html;charset=UTF-8")
5456

5557

58+
@control_silo_view
5659
@csrf_exempt
5760
@login_required
5861
@dsa_view()
@@ -90,6 +93,7 @@ def complete(request, backend, *args, **kwargs):
9093
return HttpResponseRedirect(url)
9194

9295

96+
@control_silo_view
9397
def auth_complete(request, backend, user, *args, **kwargs):
9498
"""Complete auth process. Return authenticated user or None."""
9599
if request.session.get(PIPELINE_KEY):

static/app/data/controlsiloUrlPatterns.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const patterns: RegExp[] = [
5959
new RegExp('^500/'),
6060
new RegExp('^404/'),
6161
new RegExp('^_warmup/$'),
62+
new RegExp('^api/client-config/?$'),
6263
new RegExp('^api/0/organizations/[^/]+/api-keys/$'),
6364
new RegExp('^api/0/organizations/[^/]+/api-keys/[^/]+/$'),
6465
new RegExp('^api/0/organizations/[^/]+/audit-logs/$'),
@@ -165,6 +166,7 @@ const patterns: RegExp[] = [
165166
new RegExp('^oauth/token/$'),
166167
new RegExp('^oauth/userinfo/$'),
167168
new RegExp('^saml/acs/[^/]+/$'),
169+
new RegExp('^saml/sls/[^/]+/$'),
168170
new RegExp('^auth/login/$'),
169171
new RegExp('^auth/login/[^/]+/$'),
170172
new RegExp('^auth/channel/[^/]+/[^/]+/$'),
@@ -188,6 +190,7 @@ const patterns: RegExp[] = [
188190
new RegExp('^avatar/[^/]+/$'),
189191
new RegExp('^sentry-app-avatar/[^/]+/$'),
190192
new RegExp('^doc-integration-avatar/[^/]+/$'),
193+
new RegExp('^extensions/[^/]+/setup/$'),
191194
new RegExp('^extensions/jira/ui-hook/$'),
192195
new RegExp('^extensions/jira/descriptor/$'),
193196
new RegExp('^extensions/jira/installed/$'),
@@ -209,13 +212,15 @@ const patterns: RegExp[] = [
209212
new RegExp('^extensions/bitbucket/installed/$'),
210213
new RegExp('^extensions/bitbucket/uninstalled/$'),
211214
new RegExp('^extensions/bitbucket/search/[^/]+/[^/]+/$'),
215+
new RegExp('^extensions/vercel/configure/$'),
212216
new RegExp('^extensions/vercel/delete/$'),
213217
new RegExp('^extensions/vercel/webhook/$'),
214218
new RegExp('^extensions/msteams/webhook/$'),
215219
new RegExp('^extensions/msteams/configure/$'),
216220
new RegExp('^extensions/msteams/link-identity/[^/]+/$'),
217221
new RegExp('^extensions/msteams/unlink-identity/[^/]+/$'),
218222
new RegExp('^extensions/discord/interactions/$'),
223+
new RegExp('^extensions/discord/configure/$'),
219224
new RegExp('^extensions/discord/link-identity/[^/]+/$'),
220225
new RegExp('^extensions/discord/unlink-identity/[^/]+/$'),
221226
new RegExp('^share/(?:group|issue)/[^/]+/$'),

0 commit comments

Comments
 (0)