-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: Errors migration (#1801)"
This reverts commit efc62e8. Reverting until getsentry/self-hosted#920 is also ready to be merged otherwise the onpremise e2e test will not pass.
- Loading branch information
Showing
8 changed files
with
72 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""\ | ||
Backfills the errors table from events. | ||
This script will eventually be moved to a migration - after we have a multistorage | ||
consumer running in all environments populating new events into both tables. | ||
Errors replacements should be turned off while this script is running. | ||
""" | ||
from snuba.migrations.backfill_errors import backfill_errors | ||
|
||
backfill_errors() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
snuba/migrations/snuba_migrations/events/0015_truncate_events.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from snuba.clusters.cluster import ClickhouseClientSettings | ||
from snuba.datasets.storages import StorageKey | ||
from snuba.datasets.storages.factory import get_writable_storage | ||
from snuba.migrations.backfill_errors import backfill_errors | ||
from tests.fixtures import get_raw_event | ||
from tests.helpers import write_unprocessed_events | ||
|
||
|
||
def test_backfill_errors() -> None: | ||
errors_storage = get_writable_storage(StorageKey.ERRORS) | ||
clickhouse = errors_storage.get_cluster().get_query_connection( | ||
ClickhouseClientSettings.QUERY | ||
) | ||
errors_table_name = errors_storage.get_table_writer().get_schema().get_table_name() | ||
|
||
def get_errors_count() -> int: | ||
return clickhouse.execute(f"SELECT count() from {errors_table_name}")[0][0] | ||
|
||
raw_events = [] | ||
for i in range(10): | ||
event = get_raw_event() | ||
raw_events.append(event) | ||
|
||
events_storage = get_writable_storage(StorageKey.EVENTS) | ||
|
||
write_unprocessed_events(events_storage, raw_events) | ||
|
||
assert get_errors_count() == 0 | ||
|
||
backfill_errors() | ||
|
||
assert get_errors_count() == 10 | ||
|
||
assert clickhouse.execute( | ||
f"SELECT contexts.key, contexts.value from {errors_table_name} LIMIT 1;" | ||
)[0] == ( | ||
( | ||
"device.model_id", | ||
"geo.city", | ||
"geo.country_code", | ||
"geo.region", | ||
"os.kernel_version", | ||
), | ||
("Galaxy", "San Francisco", "US", "CA", "1.1.1"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters