Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sourcemaps): Add sourcemapped subcolumn to errors #6772

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions snuba/datasets/configuration/events/storages/errors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ schema:
type: UInt,
args: { schema_modifiers: [nullable], size: 16 },
},
{
name: sourcemapped,
type: UInt,
args: { schema_modifiers: [nullable], size: 8 },
},
],
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
from typing import Sequence

from snuba.clickhouse.columns import Column, String, UInt
from snuba.clusters.storage_sets import StorageSetKey
from snuba.migrations import migration, operations
from snuba.migrations.columns import MigrationModifiers as Modifiers
from snuba.migrations.operations import OperationTarget
from snuba.utils.schemas import Nested


class Migration(migration.ClickhouseNodeMigration):
blocking = False

storage_set_key = StorageSetKey.EVENTS

local_table_name = "errors_local"
dist_table_name = "errors_dist"

column_before = Column(
"exception_frames",
Nested(
[
("abs_path", String(Modifiers(nullable=True))),
("colno", UInt(32, Modifiers(nullable=True))),
("filename", String(Modifiers(nullable=True))),
("function", String(Modifiers(nullable=True))),
("lineno", UInt(32, Modifiers(nullable=True))),
("in_app", UInt(8, Modifiers(nullable=True))),
("package", String(Modifiers(nullable=True))),
("module", String(Modifiers(nullable=True))),
("stack_level", UInt(16, Modifiers(nullable=True))),
]
),
)

column_after = Column(
"exception_frames",
Nested(
[
("abs_path", String(Modifiers(nullable=True))),
("colno", UInt(32, Modifiers(nullable=True))),
("filename", String(Modifiers(nullable=True))),
("function", String(Modifiers(nullable=True))),
("lineno", UInt(32, Modifiers(nullable=True))),
("in_app", UInt(8, Modifiers(nullable=True))),
("package", String(Modifiers(nullable=True))),
("module", String(Modifiers(nullable=True))),
("stack_level", UInt(16, Modifiers(nullable=True))),
("sourcemapped", UInt(8, Modifiers(nullable=True))),
]
),
)

def forwards_ops(self) -> Sequence[operations.SqlOperation]:
return [
operations.ModifyColumn(
storage_set=self.storage_set_key,
table_name=table_name,
column=self.column_after,
target=target,
)
for table_name, target in [
(self.local_table_name, OperationTarget.LOCAL),
(self.dist_table_name, OperationTarget.DISTRIBUTED),
]
]

def backwards_ops(self) -> Sequence[operations.SqlOperation]:
return [
operations.ModifyColumn(
storage_set=self.storage_set_key,
table_name=table_name,
column=self.column_before,
target=target,
)
for table_name, target in [
(self.local_table_name, OperationTarget.LOCAL),
(self.dist_table_name, OperationTarget.DISTRIBUTED),
]
]
Loading