|
5 | 5 | from collections.abc import Callable
|
6 | 6 | from dataclasses import dataclass
|
7 | 7 |
|
8 |
| -import sentry_sdk |
9 | 8 | from django.conf import settings
|
10 | 9 | from django.utils.encoding import force_str
|
11 | 10 | from rest_framework.authentication import get_authorization_header
|
12 | 11 | from rest_framework.request import Request
|
13 | 12 | from rest_framework.response import Response
|
14 | 13 |
|
15 | 14 | from sentry.auth.services.auth import AuthenticatedToken
|
16 |
| -from sentry.options.rollout import in_random_rollout |
17 | 15 | from sentry.types.ratelimit import RateLimitMeta, SnubaRateLimitMeta
|
18 | 16 | from sentry.utils import metrics
|
19 | 17 |
|
@@ -104,6 +102,8 @@ def _create_api_access_log(
|
104 | 102 | request_user = getattr(request, "user", None)
|
105 | 103 | user_id = getattr(request_user, "id", None)
|
106 | 104 | is_app = getattr(request_user, "is_sentry_app", None)
|
| 105 | + # TODO: `org_id` is often None even if we should have it |
| 106 | + # Likely `organization` is not being correctly set in the base endpoints on _request |
107 | 107 | org_id = getattr(getattr(request, "organization", None), "id", None)
|
108 | 108 | entity_id = getattr(request_auth, "entity_id", None)
|
109 | 109 | status_code = getattr(response, "status_code", 500)
|
@@ -131,9 +131,6 @@ def _create_api_access_log(
|
131 | 131 | api_access_logger.info("api.access", extra=log_metrics)
|
132 | 132 | metrics.incr("middleware.access_log.created")
|
133 | 133 |
|
134 |
| - if in_random_rollout("issues.log-access-logs") and not org_id: |
135 |
| - sentry_sdk.capture_message("Acesss log created without org_id", level="debug") |
136 |
| - |
137 | 134 | except Exception:
|
138 | 135 | api_access_logger.exception("api.access: Error capturing API access logs")
|
139 | 136 |
|
|
0 commit comments