Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/query-adjustments' into store-al…
Browse files Browse the repository at this point in the history
…ert-status
  • Loading branch information
tym-xqo committed Aug 6, 2019
2 parents fa3708e + 1792897 commit f0f4fa0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions query_files/long-xact.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
status: clear
threshold:
field: duration
gate: 300
---
WITH i AS (
SELECT pid
, usename
, left(query, 80) AS query
, extract(epoch FROM age(clock_timestamp(), xact_start)) AS duration
FROM pg_stat_activity
WHERE backend_type = 'client backend'
AND state = 'idle in transaction'
ORDER BY 4 desc
LIMIT 1)
SELECT * FROM i
UNION
SELECT 0, 'no user', 'no query', 0
WHERE NOT EXISTS (SELECT * FROM i)
2 changes: 1 addition & 1 deletion query_files/waits.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
status: clear
status: failure
threshold:
field: duration
gate: 30
Expand Down

0 comments on commit f0f4fa0

Please sign in to comment.