Skip to content

Commit

Permalink
feat(search-issues): Start writing message column in search issues (#…
Browse files Browse the repository at this point in the history
…4387)

This adds the `message` column to search issues and starts writing to it. `message` is already being
sent, but we missed including it a column initially.

I will let this write for a week or two before switching over to use it. We don't need the full 90
days of data for this to be effective.
  • Loading branch information
wedamija authored Jun 22, 2023
1 parent 94fa31a commit 265a7a5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ schema:
{ name: group_id, type: UInt, args: { size: 64 } },
{ name: search_title, type: String },
{ name: resource_id, type: String },
{ name: message, type: String },
{ name: subtitle, type: String },
{ name: culprit, type: String },
{ name: level, type: String, args: { schema_modifiers: [ low_cardinality ] } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ schema:


{ name: resource_id, type: String, args: { schema_modifiers: [ nullable ] } },
{ name: message, type: String },
{ name: subtitle, type: String, args: { schema_modifiers: [ nullable ] } },
{ name: culprit, type: String, args: { schema_modifiers: [ nullable ] } },
{ name: level, type: String, args: { schema_modifiers: [ nullable ] } },
Expand Down
2 changes: 2 additions & 0 deletions snuba/datasets/processors/search_issues_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class SearchIssueEvent(TypedDict, total=False):
group_id: int
platform: str
primary_hash: str
message: str
datetime: str

data: IssueEventData
Expand Down Expand Up @@ -276,6 +277,7 @@ def process_insert_v1(
"receive_timestamp": receive_timestamp,
"client_timestamp": client_timestamp,
"platform": event["platform"],
"message": _unicodify(event["message"]),
}

# optional fields
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions tests/datasets/test_search_issues_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def message_base() -> SearchIssueEvent:
"primary_hash": str(uuid.uuid4()),
"datetime": datetime.utcnow().isoformat() + "Z",
"platform": "other",
"message": "something",
"data": {
"received": datetime.now().timestamp(),
},
Expand Down Expand Up @@ -70,6 +71,7 @@ class TestSearchIssuesMessageProcessor:
"platform",
"tags.key",
"tags.value",
"message",
}

def process_message(
Expand Down Expand Up @@ -439,6 +441,14 @@ def test_extract_replay_id(self, message_base):
with pytest.raises(ValueError):
self.process_message(message_base)

def test_extract_message(self, message_base):
message = "a message"
message_base["message"] = message
processed = self.process_message(message_base)
self.assert_required_columns(processed)
insert_row = processed.rows[0]
assert insert_row["message"] == message

def test_ensure_uuid(self):
with pytest.raises(ValueError):
ensure_uuid("not_a_uuid")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_search_issues_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def base_insert_event(
"primary_hash": str(uuid.uuid4()),
"datetime": datetime.utcnow().isoformat() + "Z",
"platform": "other",
"message": "message",
"data": {
"received": now.timestamp(),
},
Expand Down Expand Up @@ -94,6 +95,7 @@ def test_simple_search_query(self) -> None:
primary_hash=str(uuid.uuid4().hex),
datetime=datetime.utcnow().isoformat() + "Z",
platform="other",
message="message",
data={"received": now.timestamp()},
occurrence_data=dict(
id=str(uuid.uuid4().hex),
Expand Down

0 comments on commit 265a7a5

Please sign in to comment.