Skip to content

Commit

Permalink
ref: Remove another sampling option (#13673)
Browse files Browse the repository at this point in the history
* ref: Clean up renormalization 2

* fix: Remove old monkeypatch
  • Loading branch information
untitaker authored Jun 19, 2019
1 parent 0706143 commit 0b29dbe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
15 changes: 2 additions & 13 deletions src/sentry/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from semaphore.processing import StoreNormalizer

from sentry import eventtypes, options
from sentry import eventtypes
from sentry.constants import EVENT_ORDERING_KEY
from sentry.db.models import (
BoundedBigIntegerField,
Expand All @@ -41,17 +41,6 @@
from sentry.utils.strings import truncatechars


def _should_disable_trim(event_id):
if not event_id:
return False

sample_rate = options.get('store.disable-trim-in-renormalization')
if sample_rate == 0:
return False

return int(md5(event_id).hexdigest(), 16) % (10 ** 8) <= (sample_rate * (10 ** 8))


class EventDict(CanonicalKeyDict):
"""
Creating an instance of this dictionary will send the event through basic
Expand All @@ -71,7 +60,7 @@ def __init__(self, data, skip_renormalization=False, **kwargs):
if not skip_renormalization and not is_renormalized:
normalizer = StoreNormalizer(
is_renormalize=True,
enable_trimming=not _should_disable_trim(data.get('event_id'))
enable_trimming=False,
)
data = normalizer.normalize_event(dict(data))

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/options/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@

# Normalization after processors
register('store.normalize-after-processing', default=0.0) # unused
register('store.disable-trim-in-renormalization', default=0.0)
register('store.disable-trim-in-renormalization', default=0.0) # unused

# Post Process Error Hook Sampling
register('post-process.use-error-hook-sampling', default=False)
Expand Down
6 changes: 0 additions & 6 deletions src/sentry/utils/pytest/sentry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import

import pytest
import mock
import os

Expand Down Expand Up @@ -253,8 +252,3 @@ def pytest_runtest_teardown(item):
model.objects.clear_local_cache()

Hub.main.bind_client(None)


@pytest.fixture(autouse=True)
def _disable_renormalization_trim(monkeypatch):
monkeypatch.setattr('sentry.models.event._should_disable_trim', lambda _: True)

0 comments on commit 0b29dbe

Please sign in to comment.