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

[sc-28901] Validate query logs as they're parsed #986

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
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
7 changes: 5 additions & 2 deletions metaphor/common/file_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@
)

def _finalize_current_mce(self) -> None:
self._mces.append(EventUtil.build_then_trim(QueryLogs(logs=self._logs)))
event = EventUtil.build_then_trim(QueryLogs(logs=self._logs))
if EventUtil().validate_message(event) is None:
raise ValueError(f"Cannot validate query log batch: {event}")

Check warning on line 104 in metaphor/common/file_sink.py

View check run for this annotation

Codecov / codecov/patch

metaphor/common/file_sink.py#L104

Added line #L104 was not covered by tests
self._mces.append(event)
self._logs_count = 0
self._logs.clear()
self._mces_count += 1
self.total_mces_wrote += 1

def _finalize_current_batch(self) -> None:
# No need to validate mce
# self._mces is already validated
self.storage.write_file(
f"{self.path}/query_logs-{self.completed_batches}.json",
json.dumps(self._mces),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.14.106"
version = "0.14.107"
license = "Apache-2.0"
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app."
authors = ["Metaphor <[email protected]>"]
Expand Down
Loading