-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for pg_stat_statements to Metricbeat Postgresql module (#…
…7060) Add a new metricset, `statements` to the Metricbeat Postgres module. This metricset will poll [`pg_stat_statements`](https://www.postgresql.org/docs/9.6/static/pgstatstatements.html) and provide per-query statistic information which is not obtainable with just the current `activity` and `database` metricsets.
- Loading branch information
Showing
16 changed files
with
613 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-metricset-postgresql-statement]] | ||
=== PostgreSQL statement metricset | ||
|
||
beta[] | ||
|
||
include::../../../module/postgresql/statement/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-postgresql,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../module/postgresql/statement/_meta/data.json[] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FROM postgres:9.5.3 | ||
HEALTHCHECK --interval=10s --retries=6 CMD psql -h localhost -U postgres -l | ||
COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d | ||
HEALTHCHECK --interval=10s --retries=6 CMD psql -h localhost -U postgres -l |
2 changes: 2 additions & 0 deletions
2
metricbeat/module/postgresql/_meta/docker-entrypoint-initdb.d/0-enable-pg_stat_statements.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
echo -e "shared_preload_libraries = 'pg_stat_statements'\npg_stat_statements.max = 10000\npg_stat_statements.track = all" >> $PGDATA/postgresql.conf |
1 change: 1 addition & 0 deletions
1
...ule/postgresql/_meta/docker-entrypoint-initdb.d/1-create-extension-pg_stat_statements.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create extension pg_stat_statements; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"@timestamp": "2017-10-12T08:05:34.853Z", | ||
"beat": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"metricset": { | ||
"host": "postgresql:5432", | ||
"module": "postgresql", | ||
"name": "statement", | ||
"rtt": 115 | ||
}, | ||
"postgresql": { | ||
"statement": { | ||
"user": { | ||
"id": 10 | ||
}, | ||
"database": { | ||
"oid": "12407" | ||
}, | ||
"query": { | ||
"id": "3240664890", | ||
"text": "SELECT pg_sleep(?);", | ||
"calls": "2", | ||
"rows": "2", | ||
"time": { | ||
"total": 120066.497, | ||
"min": 60029.533, | ||
"max": 60036.964, | ||
"mean": 60033.2485, | ||
"stddev": 3.71549999999843 | ||
}, | ||
"memory": { | ||
"shared": { | ||
"hit": 0, | ||
"read": 0, | ||
"dirtied": 0, | ||
"written": 0, | ||
}, | ||
"local": { | ||
"hit": 0, | ||
"read": 0, | ||
"dirtied": 0, | ||
"written": 0, | ||
}, | ||
"temp": { | ||
"read": 0, | ||
"written": 0, | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
=== postgresql statement MetricSet | ||
|
||
This is the statement metricset of the module postgresql. |
Oops, something went wrong.