Skip to content

Commit ef20265

Browse files
cvxluoandrewshie-sentry
authored andcommitted
ref(access-logs): revert logging access logs (#97643)
Reverts #97183 (also see getsentry/sentry-options-automator#4886) — even with the additional information, I haven't been able to narrow down the issue and am planning to move on (https://linear.app/getsentry/issue/ID-805/fix-missing-organization-id-in-api-access-logs for more investigation), so this cleans the leftover logging up before I stop working on it.
1 parent 14d4f28 commit ef20265

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/sentry/middleware/access_log.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
from collections.abc import Callable
66
from dataclasses import dataclass
77

8-
import sentry_sdk
98
from django.conf import settings
109
from django.utils.encoding import force_str
1110
from rest_framework.authentication import get_authorization_header
1211
from rest_framework.request import Request
1312
from rest_framework.response import Response
1413

1514
from sentry.auth.services.auth import AuthenticatedToken
16-
from sentry.options.rollout import in_random_rollout
1715
from sentry.types.ratelimit import RateLimitMeta, SnubaRateLimitMeta
1816
from sentry.utils import metrics
1917

@@ -104,6 +102,8 @@ def _create_api_access_log(
104102
request_user = getattr(request, "user", None)
105103
user_id = getattr(request_user, "id", None)
106104
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
107107
org_id = getattr(getattr(request, "organization", None), "id", None)
108108
entity_id = getattr(request_auth, "entity_id", None)
109109
status_code = getattr(response, "status_code", 500)
@@ -131,9 +131,6 @@ def _create_api_access_log(
131131
api_access_logger.info("api.access", extra=log_metrics)
132132
metrics.incr("middleware.access_log.created")
133133

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-
137134
except Exception:
138135
api_access_logger.exception("api.access: Error capturing API access logs")
139136

src/sentry/options/defaults.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,8 +3448,6 @@
34483448
flags=FLAG_AUTOMATOR_MODIFIABLE,
34493449
)
34503450

3451-
register("issues.log-access-logs", type=Float, default=0.0, flags=FLAG_AUTOMATOR_MODIFIABLE)
3452-
34533451
# Use "first-seen" group instead of "most-seen" group when merging
34543452
register(
34553453
"issues.merging.first-seen",

0 commit comments

Comments
 (0)