From bf8dff453fb47ab953bc33bf350423fed507081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Thu, 20 Aug 2026 15:32:51 -0600 Subject: [PATCH] fix[agent-manager](collectors): fixed collector list tenant filtering --- agent-manager/agent/collector_imp.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/agent-manager/agent/collector_imp.go b/agent-manager/agent/collector_imp.go index e09fd0865..4cc6f01bb 100644 --- a/agent-manager/agent/collector_imp.go +++ b/agent-manager/agent/collector_imp.go @@ -250,13 +250,16 @@ func (s *CollectorService) ListCollector(ctx context.Context, req *ListRequest) // Scoped by the caller: the panel asks for one tenant, and only the // platform asks for all of them. - where := "" if req.GetTenantId() != "" { - where = fmt.Sprintf("tenant_id = '%s'", sanitizeTenant(req.GetTenantId())) + filter = append(filter, utils.Filter{ + Field: "tenant_id", + Op: utils.Is, + Value:sanitizeTenant(req.GetTenantId()), + }) } collectors := []models.Collector{} - total, err := s.DBConnection.GetByPagination(&collectors, page, filter, where, false) + total, err := s.DBConnection.GetByPagination(&collectors, page, filter, "", false) if err != nil { catcher.Error("failed to fetch collectors", err, map[string]any{"process": "agent-manager"}) return nil, status.Errorf(codes.Internal, "failed to fetch collectors: %v", err)