From c96b5e8ec53ab03147951eac5a604b75adbbb3a9 Mon Sep 17 00:00:00 2001 From: Wes Date: Mon, 6 May 2024 10:22:45 -0700 Subject: [PATCH] fix: events filter by request keys query (#1416) --- backend/controller/dal/dal_test.go | 6 ++++++ backend/controller/dal/events.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/controller/dal/dal_test.go b/backend/controller/dal/dal_test.go index 552a3d1888..d9658d99e4 100644 --- a/backend/controller/dal/dal_test.go +++ b/backend/controller/dal/dal_test.go @@ -290,6 +290,12 @@ func TestDAL(t *testing.T) { assert.NoError(t, err) assertEventsEqual(t, []Event{logEvent}, events) }) + + t.Run("ByRequests", func(t *testing.T) { + events, err := dal.QueryEvents(ctx, 1000, FilterRequests(requestKey)) + assert.NoError(t, err) + assertEventsEqual(t, []Event{callEvent, logEvent}, events) + }) }) t.Run("GetRoutingTable", func(t *testing.T) { diff --git a/backend/controller/dal/events.go b/backend/controller/dal/events.go index fd7c3d7dbb..adec1b2a92 100644 --- a/backend/controller/dal/events.go +++ b/backend/controller/dal/events.go @@ -277,7 +277,7 @@ func (d *DAL) QueryEvents(ctx context.Context, limit int, filters ...EventFilter q += fmt.Sprintf(` AND e.deployment_id = ANY($%d::BIGINT[])`, param(deploymentIDs)) if filter.requests != nil { - q += fmt.Sprintf(` AND ir.name = ANY($%d::TEXT[])`, param(filter.requests)) + q += fmt.Sprintf(` AND ir.key = ANY($%d::TEXT[])`, param(filter.requests)) } if filter.types != nil { // Why are we double casting? Because I hit "cannot find encode plan" and