PG-160: Integration with PGXN.

pull/70/head
Ibrar Ahmed 2021-01-11 17:57:27 +00:00
parent 97a9f44be6
commit 84de947da6
2 changed files with 48 additions and 0 deletions

46
META.json Normal file
View File

@ -0,0 +1,46 @@
{
"name": "pg_stat_monitor",
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"description": "The pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL's contrib module pg_stat_statements. PostgreSQLs pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user needs to calculate the aggregate which is quite expensive.",
"version": "0.7.1",
"maintainer": [
"ibrar.ahmed@percona.com"
],
"license": "postgresql",
"provides": {
"pg_stat_monitor": {
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"file": "pg_stat_monitor--1.0.sql",
"docfile": "README.md",
"version": "0.7.1"
}
},
"prereqs": {
"runtime": {
"requires": {
"PostgreSQL": "11.0.0"
}
}
},
"resources": {
"bugtracker": {
"web": "https://jira.percona.com/projects/PG/issues"
},
"repository": {
"url": "https://github.com/percona/pg_stat_monitor.git",
"web": "https://github.com/percona/pg_stat_monitor",
"type": "git"
}
},
"generated_by": "ibrar.ahmed@percona.com",
"meta-spec": {
"version": "1.0.0",
"url": "http://pgxn.org/meta/spec.txt"
},
"tags": [
"monitoring",
"statistics-collector",
"statistics"
]
}

View File

@ -1196,6 +1196,8 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
values[i++] = CStringGetTextDatum(pgss->bucket_start_time[entry->key.bucket_id]); values[i++] = CStringGetTextDatum(pgss->bucket_start_time[entry->key.bucket_id]);
for (kind = 0; kind < PGSS_NUMKIND; kind++) for (kind = 0; kind < PGSS_NUMKIND; kind++)
{ {
if (tmp.calls[kind].calls == 0)
tmp.calls[kind].calls++;
values[i++] = Int64GetDatumFast(tmp.calls[kind].calls); values[i++] = Int64GetDatumFast(tmp.calls[kind].calls);
values[i++] = Float8GetDatumFast(tmp.time[kind].total_time); values[i++] = Float8GetDatumFast(tmp.time[kind].total_time);
values[i++] = Float8GetDatumFast(tmp.time[kind].min_time); values[i++] = Float8GetDatumFast(tmp.time[kind].min_time);