Skip to content

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

fix(slow-query): use right end timestamp and sync slow query for all PG databases (#11127)

rebelicefcb09766af39
diff --git a/backend/runner/slowquerysync/syncer.go b/backend/runner/slowquerysync/syncer.go
index 04b87a2c88..9f7ac5e10b 100644
--- a/backend/runner/slowquerysync/syncer.go
+++ b/backend/runner/slowquerysync/syncer.go
@@ -199,7 +199,7 @@ func (s *Syncer) syncPostgreSQLSlowQuery(ctx context.Context, instance *store.In
latestLogDate = latestLogDate.Truncate(24 * time.Hour)
nextLogDate := latestLogDate.AddDate(0, 0, 1)
- for _, database := range enabledDatabases {
+ for _, database := range databases {
statistics, exists := logMap[database.DatabaseName]
if !exists {
continue
diff --git a/frontend/src/components/SlowQuery/Panel/types.ts b/frontend/src/components/SlowQuery/Panel/types.ts
index 51182351e5..f324bfff6d 100644
--- a/frontend/src/components/SlowQuery/Panel/types.ts
+++ b/frontend/src/components/SlowQuery/Panel/types.ts
@@ -35,11 +35,11 @@ export const buildListSlowQueriesRequest = (
query.push(`project = "projects/${project}"`);
}
if (fromTime) {
- const start = dayjs(fromTime).format("YYYY-MM-DDT00:00:00.000Z");
+ const start = dayjs(fromTime).toISOString();
query.push(`start_time >= "${start}"`);
}
if (toTime) {
- const end = dayjs(toTime).format("YYYY-MM-DDT00:00:00.000Z");
+ const end = dayjs(toTime).toISOString();
query.push(`start_time <= "${end}"`);
}
if (query.length > 0) {