mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
pg cron logs: fix chart query and add error condition (#32995)
This commit is contained in:
1 parent
c32baab60a
commit
cefb527be7
1 file changed
+10
-1
@@ -320,10 +320,17 @@ export const genChartQuery = (
|
||||
filters: Filters
|
||||
) => {
|
||||
const [startOffset, trunc] = calcChartStart(params)
|
||||
const where = genWhereStatement(table, filters)
|
||||
let where = genWhereStatement(table, filters)
|
||||
const errorCondition = getErrorCondition(table)
|
||||
const warningCondition = getWarningCondition(table)
|
||||
|
||||
// pg_cron logs are a subset of postgres logs
|
||||
// to calculate the chart, we need to query postgres logs
|
||||
if (table === LogsTableName.PG_CRON) {
|
||||
table = LogsTableName.POSTGRES
|
||||
where = `where (parsed.application_name = 'pg_cron' OR event_message LIKE '%cron job%')`
|
||||
}
|
||||
|
||||
let joins = genCrossJoinUnnests(table)
|
||||
|
||||
const q = `
|
||||
@@ -597,6 +604,8 @@ function getErrorCondition(table: LogsTableName): string {
|
||||
return 'response.status_code >= 500'
|
||||
case 'function_logs':
|
||||
return "metadata.level IN ('error', 'fatal')"
|
||||
case 'pg_cron_logs':
|
||||
return "parsed.error_severity IN ('ERROR', 'FATAL', 'PANIC')"
|
||||
default:
|
||||
return 'false'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user