Skip to content

Commit

Permalink
Improve couchbase module (#3545)
Browse files Browse the repository at this point in the history
* Fix typo spacial to spatial. Change fieldnames couchbase.node.couch.*.actual_disk_size.* to couchbase.node.couch.*.disk_size.* for consistency.
* Add system tests to verify docs
* Update data.json
  • Loading branch information
ruflin authored and monicasarbu committed Feb 7, 2017
1 parent f7cc4c7 commit a8bd416
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 55 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- Linux cgroup metrics are now enabled by default for the system process
metricset. The configuration option for the feature was renamed from
`cgroups` to `process.cgroups.enabled`. {pull}3519[3519]
- Change fieldnames couchbase.node.couch.*.actual_disk_size.* to couchbase.node.couch.*.disk_size.* {pull}3545[3545]

*Packetbeat*

Expand Down
4 changes: 2 additions & 2 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ Number of get commands
[float]
=== couchbase.node.couch.docs.actual_disk_size.bytes
=== couchbase.node.couch.docs.disk_size.bytes
type: long
Expand Down Expand Up @@ -1096,7 +1096,7 @@ couchSpatialDiskSize field
[float]
=== couchbase.node.couch.views.actual_disk_size.bytes
=== couchbase.node.couch.views.disk_size.bytes
type: long
Expand Down
8 changes: 4 additions & 4 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,14 @@
"properties": {
"docs": {
"properties": {
"actual_disk_size": {
"data_size": {
"properties": {
"bytes": {
"type": "long"
}
}
},
"data_size": {
"disk_size": {
"properties": {
"bytes": {
"type": "long"
Expand Down Expand Up @@ -625,14 +625,14 @@
},
"views": {
"properties": {
"actual_disk_size": {
"data_size": {
"properties": {
"bytes": {
"type": "long"
}
}
},
"data_size": {
"disk_size": {
"properties": {
"bytes": {
"type": "long"
Expand Down
8 changes: 4 additions & 4 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,14 @@
"properties": {
"docs": {
"properties": {
"actual_disk_size": {
"data_size": {
"properties": {
"bytes": {
"type": "long"
}
}
},
"data_size": {
"disk_size": {
"properties": {
"bytes": {
"type": "long"
Expand Down Expand Up @@ -620,14 +620,14 @@
},
"views": {
"properties": {
"actual_disk_size": {
"data_size": {
"properties": {
"bytes": {
"type": "long"
}
}
},
"data_size": {
"disk_size": {
"properties": {
"bytes": {
"type": "long"
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/couchbase/bucket/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"bucket": {
"data": {
"used": {
"bytes": 12597798
"bytes": 12585517
}
},
"disk": {
"fetches": 0,
"used": {
"bytes": 16368995
"bytes": 16356812
}
},
"item_count": 7303,
Expand All @@ -36,7 +36,7 @@
}
},
"metricset": {
"host": "couchbase:8091",
"host": "localhost:8091",
"module": "couchbase",
"name": "bucket",
"rtt": 115
Expand Down
16 changes: 8 additions & 8 deletions metricbeat/module/couchbase/cluster/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
"cluster": {
"hdd": {
"free": {
"bytes": 50705599693
"bytes": 49181251462
},
"quota": {
"total": {
"bytes": 63381999616
"bytes": 67371577344
}
},
"total": {
"bytes": 63381999616
"bytes": 67371577344
},
"used": {
"by_data": {
"bytes": 16368995
"bytes": 16356812
},
"value": {
"bytes": 12676399923
"bytes": 18190325882
}
}
},
Expand Down Expand Up @@ -56,21 +56,21 @@
}
},
"total": {
"bytes": 8360542208
"bytes": 2096275456
},
"used": {
"by_data": {
"bytes": 53962160
},
"value": {
"bytes": 7660535808
"bytes": 1235513344
}
}
}
}
},
"metricset": {
"host": "couchbase:8091",
"host": "localhost:8091",
"module": "couchbase",
"name": "cluster",
"rtt": 115
Expand Down
38 changes: 19 additions & 19 deletions metricbeat/module/couchbase/node/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"cmd_get": 0,
"couch": {
"docs": {
"actual_disk_size": {
"bytes": 13575997
},
"data_size": {
"bytes": 9804800
"bytes": 9796608
},
"disk_size": {
"bytes": 13567903
}
},
"spacial": {
"spatial": {
"data_size": {
"bytes": 0
},
Expand All @@ -25,38 +25,38 @@
}
},
"views": {
"actual_disk_size": {
"bytes": 2792998
},
"data_size": {
"bytes": 2792998
"bytes": 2788909
},
"disk_size": {
"bytes": 2788909
}
}
},
"cpu_utilization_rate": {
"pct": 87.08791
"pct": 4.568527918781726
},
"current_items": {
"total": 7303,
"value": 7303
},
"ep_bg_fetched": 0,
"get_hits": 0,
"hostname": "172.22.0.9:8091",
"hostname": "172.20.0.2:8091",
"mcd_memory": {
"allocated": {
"bytes": 6378
"bytes": 1599
},
"reserved": {
"bytes": 6378
"bytes": 1599
}
},
"memory": {
"free": {
"bytes": 2273726464
"bytes": 1435561984
},
"total": {
"bytes": 8360542208
"bytes": 2096275456
},
"used": {
"bytes": 53962160
Expand All @@ -65,20 +65,20 @@
"ops": 0,
"swap": {
"total": {
"bytes": 4189057024
"bytes": 0
},
"used": {
"bytes": 58044416
"bytes": 0
}
},
"uptime": {
"sec": 50492
"sec": 891
},
"vb_replica_curr_items": 0
}
},
"metricset": {
"host": "couchbase:8091",
"host": "localhost:8091",
"module": "couchbase",
"name": "node",
"rtt": 115
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/couchbase/node/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
type: long
description: >
Number of get commands
- name: couch.docs.actual_disk_size.bytes
- name: couch.docs.disk_size.bytes
format: bytes
type: long
description: >
Expand All @@ -27,7 +27,7 @@
type: long
description: >
couchSpatialDiskSize field
- name: couch.views.actual_disk_size.bytes
- name: couch.views.disk_size.bytes
type: long
description: >
Amount of disk space occupied by Couch views (bytes)
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/couchbase/node/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func eventsMapping(content []byte) []common.MapStr {
"cmd_get": NodeItem.InterestingStats.CmdGet,
"couch": common.MapStr{
"docs": common.MapStr{
"actual_disk_size": common.MapStr{
"disk_size": common.MapStr{
"bytes": NodeItem.InterestingStats.CouchDocsActualDiskSize,
},
"data_size": common.MapStr{
"bytes": NodeItem.InterestingStats.CouchDocsDataSize,
},
},
"spacial": common.MapStr{
"spatial": common.MapStr{
"data_size": common.MapStr{
"bytes": NodeItem.InterestingStats.CouchSpatialDataSize,
},
Expand All @@ -89,7 +89,7 @@ func eventsMapping(content []byte) []common.MapStr {
},
},
"views": common.MapStr{
"actual_disk_size": common.MapStr{
"disk_size": common.MapStr{
"bytes": NodeItem.InterestingStats.CouchViewsActualDiskSize,
},
"data_size": common.MapStr{
Expand Down
18 changes: 9 additions & 9 deletions metricbeat/module/couchbase/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ func TestFetchEventContents(t *testing.T) {
couch := event["couch"].(common.MapStr)

couch_docs := couch["docs"].(common.MapStr)
couch_docs_actual_disk_size := couch_docs["actual_disk_size"].(common.MapStr)
assert.EqualValues(t, 13563791, couch_docs_actual_disk_size["bytes"])
couch_docs_disk_size := couch_docs["disk_size"].(common.MapStr)
assert.EqualValues(t, 13563791, couch_docs_disk_size["bytes"])

couch_docs_data_size := couch_docs["data_size"].(common.MapStr)
assert.EqualValues(t, 9792512, couch_docs_data_size["bytes"])

couch_spacial := couch["spacial"].(common.MapStr)
couch_spacial_data_size := couch_spacial["data_size"].(common.MapStr)
assert.EqualValues(t, 0, couch_spacial_data_size["bytes"])
couch_spatial := couch["spatial"].(common.MapStr)
couch_spatial_data_size := couch_spatial["data_size"].(common.MapStr)
assert.EqualValues(t, 0, couch_spatial_data_size["bytes"])

couch_spacial_disk_size := couch_spacial["disk_size"].(common.MapStr)
assert.EqualValues(t, 0, couch_spacial_disk_size["bytes"])
couch_spatial_disk_size := couch_spatial["disk_size"].(common.MapStr)
assert.EqualValues(t, 0, couch_spatial_disk_size["bytes"])

couch_views := couch["views"].(common.MapStr)
couch_views_actual_disk_size := couch_views["actual_disk_size"].(common.MapStr)
assert.EqualValues(t, 2805219, couch_views_actual_disk_size["bytes"])
couch_views_disk_size := couch_views["disk_size"].(common.MapStr)
assert.EqualValues(t, 2805219, couch_views_disk_size["bytes"])

couch_views_data_size := couch_views["data_size"].(common.MapStr)
assert.EqualValues(t, 2805219, couch_views_data_size["bytes"])
Expand Down
7 changes: 6 additions & 1 deletion metricbeat/module/couchbase/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ package couchbase
import "os"

func GetEnvDSN() string {
return os.Getenv("COUCHBASE_DSN")
dsn := os.Getenv("COUCHBASE_DSN")

if len(dsn) == 0 {
dsn = "http://Administrator:password@localhost:8091"
}
return dsn
}
Loading

0 comments on commit a8bd416

Please sign in to comment.