Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: fix panic in ListSlowQueries (#5705)

rebeliceab30c7053cac
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index 92ec729939..5d81838cbe 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -655,6 +655,11 @@ func (s *DatabaseService) ListSlowQueries(ctx context.Context, request *v1pb.Lis
if value, exists := instanceMap[database.InstanceID]; exists {
value.totalQueryTime += log.Statistics.AverageQueryTime.AsDuration() * time.Duration(log.Statistics.Count)
value.totalRowsSent += log.Statistics.AverageRowsSent * log.Statistics.Count
+ } else {
+ instanceMap[database.InstanceID] = &totalValue{
+ totalQueryTime: log.Statistics.AverageQueryTime.AsDuration() * time.Duration(log.Statistics.Count),
+ totalRowsSent: log.Statistics.AverageRowsSent * log.Statistics.Count,
+ }
}
}
}