|
1 | 1 | import copy |
2 | 2 | import inspect |
3 | | -import logging |
4 | 3 | import random |
5 | 4 |
|
6 | 5 | import sentry_sdk |
|
19 | 18 | from sentry.utils.db import DjangoAtomicIntegration |
20 | 19 | from sentry.utils.rust import RustInfoIntegration |
21 | 20 |
|
22 | | -logger = logging.getLogger(__name__) |
23 | | - |
24 | 21 | UNSAFE_FILES = ( |
25 | 22 | "sentry/event_manager.py", |
26 | 23 | "sentry/tasks/process_buffer.py", |
@@ -448,38 +445,11 @@ def _kwargs_into_scope(self, scope, extra=None, tags=None, fingerprint=None, req |
448 | 445 | scope.fingerprint = fingerprint |
449 | 446 |
|
450 | 447 |
|
451 | | -def check_tag(tag_key: str, expected_value: str) -> bool: |
452 | | - """Detect a tag already set and being different than what we expect. |
453 | | -
|
454 | | - This function checks if a tag has been already been set and if it differs |
455 | | - from what we want to set it to. |
456 | | - """ |
457 | | - with configure_scope() as scope: |
458 | | - if scope._tags and tag_key in scope._tags and scope._tags[tag_key] != expected_value: |
459 | | - extra = { |
460 | | - f"previous_{tag_key}": scope._tags[tag_key], |
461 | | - f"new_{tag_key}": expected_value, |
462 | | - } |
463 | | - logger.warning(f"Tag already set and different ({tag_key}).", extra=extra) |
464 | | - # This can be used to find errors that may have been mistagged |
465 | | - scope.set_tag("possible_mistag", True) |
466 | | - return True |
467 | | - |
468 | | - |
469 | | -# We have some events being tagged with organization.slug even when we don't have such info |
470 | | -def log_if_tags_already_set(org_id: int, org_slug: str) -> None: |
471 | | - """If the tags are already set and differ, report them as a Sentry error.""" |
472 | | - if check_tag("organization", org_id) or check_tag("organization.slug", org_slug): |
473 | | - logger.error("Intentional error for investigation. See WOR-2464.") |
474 | | - |
475 | | - |
476 | 448 | def bind_organization_context(organization): |
477 | 449 | helper = settings.SENTRY_ORGANIZATION_CONTEXT_HELPER |
478 | 450 |
|
479 | 451 | # XXX(dcramer): this is duplicated in organizationContext.jsx on the frontend |
480 | 452 | with sentry_sdk.configure_scope() as scope: |
481 | | - log_if_tags_already_set(organization.id, organization.slug) |
482 | | - |
483 | 453 | scope.set_tag("organization", organization.id) |
484 | 454 | scope.set_tag("organization.slug", organization.slug) |
485 | 455 | scope.set_context("organization", {"id": organization.id, "slug": organization.slug}) |
|
0 commit comments