From fd205114ccc03db5433c73f016282939e7105b53 Mon Sep 17 00:00:00 2001 From: Lyn Date: Wed, 28 Jun 2023 17:51:48 -0700 Subject: [PATCH] feat(dlq): If DLQ replay is kicked off, add it to audit log --- snuba/admin/audit_log/action.py | 1 + snuba/admin/views.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/snuba/admin/audit_log/action.py b/snuba/admin/audit_log/action.py index 3247338e7b..d83ebf981b 100644 --- a/snuba/admin/audit_log/action.py +++ b/snuba/admin/audit_log/action.py @@ -15,6 +15,7 @@ class AuditLogAction(Enum): REVERSED_MIGRATION_FAILED = "reversed.migration.failed" ALLOCATION_POLICY_UPDATE = "allocation_policy.update" ALLOCATION_POLICY_DELETE = "allocation_policy.delete" + DLQ_REPLAY = "dlq.replay" RUNTIME_CONFIG_ACTIONS = [ diff --git a/snuba/admin/views.py b/snuba/admin/views.py index 76c32962df..7270f65435 100644 --- a/snuba/admin/views.py +++ b/snuba/admin/views.py @@ -950,6 +950,15 @@ def dlq_replay() -> Response: slice_id, max_messages_to_process, ) + + user = request.headers.get(USER_HEADER_KEY) + + audit_log.record( + user or "", + AuditLogAction.DLQ_REPLAY, + {"instruction": str(instruction)}, + notify=True, + ) store_instruction(instruction) if request.method == "DELETE":