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: new page in snuba admin to do deletes #6168

Merged
merged 13 commits into from
Jul 31, 2024
Merged

Conversation

kylemumma
Copy link
Member

@kylemumma kylemumma commented Jul 31, 2024

this is a redo of #6157

This PR adds a page to snuba admin that we can use to test deletes in prod.

major changes

  1. create a front-end react interface for deletes
  • static/delete_tool/index.tsx is the new react UI, it calls api_client.tsx:runLightweightDelete
  • api_client.py:runLightweightDelete sends the input via http request to /delete endpoint. (note: i think it would have been equally valid to just send the http request from index.tsx rather than having this separate function, but I did it like this bc everyone else in the codebase did)
  • data.tsx adds the new page to the Nav bar
  1. create a new /delete endpoint in snuba admin admin/views.py:delete
    As said in bullet 1, the react UI sends the input to /delete. This is a new endpoint we created, it mostly just calls delete_from_storage (what Meredith implemented that actually does the delete)
  2. set permissions for /delete endpoint and UI tool_policies.py
    It just goes into AllTools by default which is the most restrictive role, only snuba team and people with access to everything can use it. I think this should be good.
  3. small delete_query.py changes
  • I slightly changed the input/output types of delete_query.py:delete_from_storage in order to make the interface more strict/clear.
  • added more input verification for the columns input.

considerations

This tool is pretty much just a layer on top of delete_from_storage meaning it can do anything that delete_from_storage can do. Hence it will be able to delete in any environment, and any dataset that has deletes enabled. Is this fine or should we add additional strictness to this interface, so that it can only be used for search_issues in s4s no matter what.

Screenshot 2024-07-30 at 1 10 29 PM

@kylemumma kylemumma changed the title Krm/admin delete feat: new page in snuba admin to do deletes Jul 31, 2024
@kylemumma kylemumma marked this pull request as ready for review July 31, 2024 21:28
@kylemumma kylemumma requested a review from a team as a code owner July 31, 2024 21:28
@MeredithAnya MeredithAnya enabled auto-merge (squash) July 31, 2024 21:40
@MeredithAnya MeredithAnya merged commit 0dce2e4 into master Jul 31, 2024
30 checks passed
@MeredithAnya MeredithAnya deleted the krm/admin-delete branch July 31, 2024 21:52
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.

3 participants