From a1c947fb8a369a62e5deb61777bf01257bc721bb Mon Sep 17 00:00:00 2001 From: Mario Castro Date: Fri, 19 Nov 2021 15:06:45 +0100 Subject: [PATCH 1/3] Fix fields --- .../postgresql/database/_meta/data.json | 82 +++++++++++-------- .../postgresql/database/_meta/fields.yml | 4 +- metricbeat/module/postgresql/database/data.go | 4 +- 3 files changed, 54 insertions(+), 36 deletions(-) diff --git a/metricbeat/module/postgresql/database/_meta/data.json b/metricbeat/module/postgresql/database/_meta/data.json index d3eef4ac6ba..e1e44a59989 100644 --- a/metricbeat/module/postgresql/database/_meta/data.json +++ b/metricbeat/module/postgresql/database/_meta/data.json @@ -1,53 +1,71 @@ { - "@timestamp": "2017-10-12T08:05:34.853Z", + "@timestamp": "2021-11-19T13:08:37.241Z", + "@metadata": { + "beat": "metricbeat", + "type": "_doc", + "version": "8.1.0" + }, + "service": { + "type": "postgresql", + "address": "postgres://localhost:5432/test?connect_timeout=10&sslmode=disable" + }, "event": { + "duration": 12127879, "dataset": "postgresql.database", - "duration": 115000, "module": "postgresql" }, - "metricset": { - "name": "database", - "period": 10000 - }, "postgresql": { "database": { + "deadlocks": 0, + "stats_reset": "2021-11-19T13:03:43.827Z", + "temporary": { + "files": 0, + "bytes": 0 + }, + "transactions": { + "rollback": 5, + "commit": 141 + }, "blocks": { - "hit": 43969, - "read": 381, "time": { "read": { - "ms": 0 + "ms": 7.686 }, "write": { "ms": 0 } - } + }, + "read": 726, + "hit": 26718 }, "conflicts": 0, - "deadlocks": 0, - "name": "postgres", - "number_of_backends": 2, - "oid": 13395, + "number_of_backends": 4, + "oid": 16384, + "name": "test", "rows": { - "deleted": 42, - "fetched": 26418, - "inserted": 98, - "returned": 53201, - "updated": 14 - }, - "stats_reset": "2021-03-05T18:39:18.089Z", - "temporary": { - "bytes": 0, - "files": 0 - }, - "transactions": { - "commit": 445, - "rollback": 5 + "deleted": 31, + "returned": 46331, + "fetched": 13006, + "inserted": 71, + "updated": 2 } } }, - "service": { - "address": "192.168.128.2:5432", - "type": "postgresql" + "ecs": { + "version": "8.0.0" + }, + "host": { + "name": "thinkpad" + }, + "agent": { + "type": "metricbeat", + "version": "8.1.0", + "ephemeral_id": "ce27b375-714a-4304-9b41-5f1cba028d6e", + "id": "7aaa6d29-9700-452a-bd12-2bdd2a2f884e", + "name": "thinkpad" + }, + "metricset": { + "name": "database", + "period": 10000 } -} \ No newline at end of file +} diff --git a/metricbeat/module/postgresql/database/_meta/fields.yml b/metricbeat/module/postgresql/database/_meta/fields.yml index 2b08d1630de..7eb5ceca4f4 100644 --- a/metricbeat/module/postgresql/database/_meta/fields.yml +++ b/metricbeat/module/postgresql/database/_meta/fields.yml @@ -36,12 +36,12 @@ that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache). - name: blocks.time.read.ms - type: long + type: double description: > Time spent reading data file blocks by backends in this database, in milliseconds. - name: blocks.time.write.ms - type: long + type: double description: > Time spent writing data file blocks by backends in this database, in milliseconds. diff --git a/metricbeat/module/postgresql/database/data.go b/metricbeat/module/postgresql/database/data.go index 99d2bdb643f..5a662a8aedb 100644 --- a/metricbeat/module/postgresql/database/data.go +++ b/metricbeat/module/postgresql/database/data.go @@ -37,8 +37,8 @@ var schema = s.Schema{ "read": c.Int("blks_read"), "hit": c.Int("blks_hit"), "time": s.Object{ - "read": s.Object{"ms": c.Int("blk_read_time")}, - "write": s.Object{"ms": c.Int("blk_write_time")}, + "read": s.Object{"ms": c.Float("blk_read_time")}, + "write": s.Object{"ms": c.Float("blk_write_time")}, }, }, "rows": s.Object{ From 1ae6cd544affa5f40aef2522ed2987d5f44a846e Mon Sep 17 00:00:00 2001 From: Mario Castro Date: Fri, 19 Nov 2021 15:14:17 +0100 Subject: [PATCH 2/3] Add changelog entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 6bb189ee301..04d5f30dd31 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -231,6 +231,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix list_docker.go {pull}28374[28374] - Use xpack.enabled on SM modules to write into .monitoring indices when using Metricbeat standalone {pull}28365[28365] - Fix in rename processor to ingest metrics for `write.iops` to proper field instead of `write_iops` in rds metricset. {pull}28960[28960] +- Fix fields not being parsed correctly in postgresql/database {issue}25301[25301] {pull}29051[29051] *Packetbeat* From 9a723c56d22cc4b92ba20faa1fd274434ed28459 Mon Sep 17 00:00:00 2001 From: Mario Castro Date: Fri, 19 Nov 2021 16:53:36 +0100 Subject: [PATCH 3/3] Make update and fix linting --- metricbeat/docs/fields.asciidoc | 4 ++-- metricbeat/module/postgresql/fields.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 9e2489352e1..6d7ba39ae83 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -53948,7 +53948,7 @@ type: long Time spent reading data file blocks by backends in this database, in milliseconds. -type: long +type: double -- @@ -53958,7 +53958,7 @@ type: long Time spent writing data file blocks by backends in this database, in milliseconds. -type: long +type: double -- diff --git a/metricbeat/module/postgresql/fields.go b/metricbeat/module/postgresql/fields.go index cd679d7edc2..2962ab237f2 100644 --- a/metricbeat/module/postgresql/fields.go +++ b/metricbeat/module/postgresql/fields.go @@ -32,5 +32,5 @@ func init() { // AssetPostgresql returns asset data. // This is the base64 encoded zlib format compressed contents of module/postgresql. func AssetPostgresql() string { - return "eJzUWk+P47oNv8+nIN7l7RbZoL3OoUCxr0AX6O7bh92ix4CR6ViILHklOZn00xeU5D+xncwkY8+2Oc0kFvkTKZE/kv4Aezo9QmWc31lyP9QDgJde0SP88jV++e2Pf/7yAJCRE1ZWXhr9CH99AAD4TN5K4UAYpUh4yiC3poRuHTiyB7Ju/QDgCmP9Rhidy90j5KgcPQBYUoSOHmGHDwC5JJ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