Skip to content

Commit

Permalink
Convert postgresql.statement.query.id to number (elastic#24359)
Browse files Browse the repository at this point in the history
It is a number, and defined as long in fields.yml, so send is as number
in the document.
  • Loading branch information
jsoriano authored Mar 5, 2021
1 parent b26beea commit a5ca07c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
21 changes: 9 additions & 12 deletions metricbeat/module/postgresql/statement/_meta/data.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"agent": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"event": {
"dataset": "postgresql.statement",
"duration": 115000,
"module": "postgresql"
},
"metricset": {
"name": "statement"
"name": "statement",
"period": 10000
},
"postgresql": {
"statement": {
Expand All @@ -19,7 +16,7 @@
},
"query": {
"calls": 2,
"id": "1592910677",
"id": 1592910677,
"memory": {
"local": {
"dirtied": 0,
Expand All @@ -42,19 +39,19 @@
"text": "SELECT * FROM pg_stat_statements",
"time": {
"max": {
"ms": 0.388
"ms": 0.161
},
"mean": {
"ms": 0.235
"ms": 0.1595
},
"min": {
"ms": 0.082
"ms": 0.158
},
"stddev": {
"ms": 0.153
"ms": 0.0015000000000000013
},
"total": {
"ms": 0.47000000000000003
"ms": 0.319
}
}
},
Expand All @@ -64,7 +61,7 @@
}
},
"service": {
"address": "172.26.0.2:5432",
"address": "192.168.144.2:5432",
"type": "postgresql"
}
}
4 changes: 2 additions & 2 deletions metricbeat/module/postgresql/statement/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
c "github.com/elastic/beats/v7/libbeat/common/schema/mapstrstr"
)

// Based on: https://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
// Based on: https://www.postgresql.org/docs/9.6/pgstatstatements.html
var schema = s.Schema{
"user": s.Object{
"id": c.Int("userid"),
Expand All @@ -31,7 +31,7 @@ var schema = s.Schema{
"oid": c.Int("dbid"),
},
"query": s.Object{
"id": c.Str("queryid"),
"id": c.Int("queryid"),
"text": c.Str("query"),
"calls": c.Int("calls"),
"rows": c.Int("rows"),
Expand Down

0 comments on commit a5ca07c

Please sign in to comment.