Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. novapay_postgres_queries:
  2. query: |-
  3. SELECT
  4. s.queryid as id,
  5. s.query,
  6. s.calls,
  7. s.mean_time,
  8. s.min_time,
  9. s.max_time,
  10. '__ROLE__' as role,
  11. round(s.total_time) as total_time
  12. FROM
  13. pg_stat_statements as s
  14. ORDER BY
  15. s.total_time DESC
  16. LIMIT 10;
  17. metrics:
  18. - id:
  19. usage: LABEL
  20. - query:
  21. usage: LABEL
  22. - role:
  23. usage: LABEL
  24. - calls:
  25. usage: GAUGE
  26. description: "Count of query calls"
  27. - mean_time:
  28. usage: GAUGE
  29. description: "Mean time of query"
  30. - min_time:
  31. usage: GAUGE
  32. description: "Minimum query's time"
  33. - max_time:
  34. usage: GAUGE
  35. description: "Maximum query's time"
  36. - total_time:
  37. usage: GAUGE
  38. description: "Total time of query execution"
  39.  
  40. novapay_postgres_locks:
  41. query: |-
  42. SELECT
  43. pg_database.datname,
  44. tmp.mode,
  45. tmp2.relation,
  46. '__ROLE__' as role,
  47. COALESCE(count, 0) as count
  48. FROM
  49. (
  50. VALUES ('accesssharelock'),
  51. ('rowsharelock'),
  52. ('rowexclusivelock'),
  53. ('shareupdateexclusivelock'),
  54. ('sharelock'),
  55. ('sharerowexclusivelock'),
  56. ('exclusivelock'),
  57. ('accessexclusivelock')
  58. ) AS tmp(mode) CROSS JOIN pg_database
  59. LEFT JOIN
  60. (SELECT
  61. database,
  62. lower(mode) AS mode,
  63. count(*) AS count,
  64. relation :: regclass
  65. FROM pg_locks
  66. WHERE database IS NOT NULL
  67. GROUP BY database, relation :: regclass, lower(mode)
  68. ) AS tmp2
  69. ON tmp.mode = tmp2.mode and pg_database.oid = tmp2.database
  70. ORDER BY 1;
  71. metrics:
  72. - datname: { usage: LABEL }
  73. - mode: { usage: LABEL }
  74. - relation: { usage: LABEL }
  75. - role: { usage: LABEL }
  76. - count: { usage: GAUGE, description: "Count of locks" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement