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

feat(weave): backend to allow deletion of calls #1655

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

gtarpenning
Copy link
Member

@gtarpenning gtarpenning commented May 16, 2024

moved to clean branch: #1673

@circle-job-mirror
Copy link

circle-job-mirror bot commented May 16, 2024

@gtarpenning gtarpenning marked this pull request as ready for review May 16, 2024 20:22
@gtarpenning gtarpenning requested a review from a team as a code owner May 16, 2024 20:22

# create insert payload for all descendants (and parents)
data = [(req.project_id, d, deleted_at) for d in all_descendants]
self._insert(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: while not necessary, it would be nice for this to use _insert_call instead of _insert. _insert feels risky to me because it is raw, untyped. _insert_call would require you to define a CallDeleteCHInsertable tp add to CallCHInsertable = typing.Union[CallStartCHInsertable, CallEndCHInsertable]

The reason i like this pattern more is that it enforces the expected schema of a delete. This is important because we absolutely must be sure that the insert only contains the fields "project_id", "id", "deleted_at"... which is enforced by this list right now. Why? Well the aggregation functions such as anySimpleState(op_name) will take any-non-null value... meaning the delete entries could inadvertently mess with other fields. This is more of the theoretical callout, so consider it optional.

@@ -1058,6 +1134,19 @@ def _insert_call(self, ch_call: CallCHInsertable) -> None:
if self._flush_immediately:
self._flush_calls()

def _insert_calls_delete(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks identical to _insert_call except that it supports a list. The column stuff should work just fine due to the Null defaults. I'd recommend just changing _insert_call to handle a list

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is how to manage all_call_delete_columns vs. all_call_insert_columns which can be different. Not ~ quite ~ identical... @tssweeney

Copy link
Contributor

@tssweeney tssweeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the wb_user_id is now ambiguous after aggregation

weave/trace_server/migrations/002_add_deleted_at.up.sql Outdated Show resolved Hide resolved
@gtarpenning gtarpenning force-pushed the griffin/deleted-at-backend branch 2 times, most recently from 7a366a0 to 912f4e9 Compare May 20, 2024 20:36
@@ -314,7 +316,7 @@ def calls_query(self, req: tsi.CallsQueryReq) -> tsi.CallsQueryRes:
order_parts.append(f"{field} {direction}")

order_by_part = ", ".join(order_parts)
query += f"ORDER BY {order_by_part}"
query += f" ORDER BY {order_by_part}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually fixes a bug

* add to sidebar

* move image

* cooler project name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants