Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- novapay_postgres_queries:
- query: |-
- SELECT
- s.queryid as id,
- s.query,
- s.calls,
- s.mean_time,
- s.min_time,
- s.max_time,
- '__ROLE__' as role,
- round(s.total_time) as total_time
- FROM
- pg_stat_statements as s
- ORDER BY
- s.total_time DESC
- LIMIT 10;
- metrics:
- - id:
- usage: LABEL
- - query:
- usage: LABEL
- - role:
- usage: LABEL
- - calls:
- usage: GAUGE
- description: "Count of query calls"
- - mean_time:
- usage: GAUGE
- description: "Mean time of query"
- - min_time:
- usage: GAUGE
- description: "Minimum query's time"
- - max_time:
- usage: GAUGE
- description: "Maximum query's time"
- - total_time:
- usage: GAUGE
- description: "Total time of query execution"
- novapay_postgres_locks:
- query: |-
- SELECT
- pg_database.datname,
- tmp.mode,
- tmp2.relation,
- '__ROLE__' as role,
- COALESCE(count, 0) as count
- FROM
- (
- VALUES ('accesssharelock'),
- ('rowsharelock'),
- ('rowexclusivelock'),
- ('shareupdateexclusivelock'),
- ('sharelock'),
- ('sharerowexclusivelock'),
- ('exclusivelock'),
- ('accessexclusivelock')
- ) AS tmp(mode) CROSS JOIN pg_database
- LEFT JOIN
- (SELECT
- database,
- lower(mode) AS mode,
- count(*) AS count,
- relation :: regclass
- FROM pg_locks
- WHERE database IS NOT NULL
- GROUP BY database, relation :: regclass, lower(mode)
- ) AS tmp2
- ON tmp.mode = tmp2.mode and pg_database.oid = tmp2.database
- ORDER BY 1;
- metrics:
- - datname: { usage: LABEL }
- - mode: { usage: LABEL }
- - relation: { usage: LABEL }
- - role: { usage: LABEL }
- - count: { usage: GAUGE, description: "Count of locks" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement