Skip to content

Commit f185be7

Browse files
committed
[Metricbeat] gcp.compute: uniform metricset's fields (#28367)
* gcp.compute: flatten fields * gcp.compute: fix firewall docs * gcp.compute: sort fields * gcp.compute: add TestFetch * gcp.compute: fix undocumented field * gcp: update fields * metricbeat: mage update (cherry picked from commit 3db67f6)
1 parent 982bd48 commit f185be7

5 files changed

Lines changed: 108 additions & 103 deletions

File tree

metricbeat/docs/fields.asciidoc

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27793,9 +27793,7 @@ type: float
2779327793
Google Cloud Compute metrics
2779427794

2779527795

27796-
27797-
27798-
*`gcp.compute.instance.firewall.dropped_bytes_count.value`*::
27796+
*`gcp.compute.firewall.dropped_bytes_count.value`*::
2779927797
+
2780027798
--
2780127799
Incoming bytes dropped by the firewall
@@ -27804,7 +27802,7 @@ type: long
2780427802

2780527803
--
2780627804

27807-
*`gcp.compute.instance.firewall.dropped_packets_count.value`*::
27805+
*`gcp.compute.firewall.dropped_packets_count.value`*::
2780827806
+
2780927807
--
2781027808
Incoming packets dropped by the firewall
@@ -27813,7 +27811,6 @@ type: long
2781327811

2781427812
--
2781527813

27816-
2781727814
*`gcp.compute.instance.cpu.reserved_cores.value`*::
2781827815
+
2781927816
--
@@ -27823,25 +27820,24 @@ type: double
2782327820

2782427821
--
2782527822

27826-
*`gcp.compute.instance.cpu.utilization.value`*::
27823+
*`gcp.compute.instance.cpu.usage_time.value`*::
2782727824
+
2782827825
--
27829-
The fraction of the allocated CPU that is currently in use on the instance
27826+
Usage for all cores in seconds
2783027827

2783127828
type: double
2783227829

2783327830
--
2783427831

27835-
*`gcp.compute.instance.cpu.usage_time.value`*::
27832+
*`gcp.compute.instance.cpu.utilization.value`*::
2783627833
+
2783727834
--
27838-
Usage for all cores in seconds
27835+
The fraction of the allocated CPU that is currently in use on the instance
2783927836

2784027837
type: double
2784127838

2784227839
--
2784327840

27844-
2784527841
*`gcp.compute.instance.disk.read_bytes_count.value`*::
2784627842
+
2784727843
--
@@ -27878,84 +27874,91 @@ type: long
2787827874

2787927875
--
2788027876

27881-
*`gcp.compute.instance.uptime.value`*::
27877+
*`gcp.compute.instance.memory.balloon.ram_size.value`*::
2788227878
+
2788327879
--
27884-
How long the VM has been running, in seconds
27880+
The total amount of memory in the VM. This metric is only available for VMs that belong to the e2 family.
2788527881

2788627882
type: long
2788727883

2788827884
--
2788927885

27890-
27891-
*`gcp.compute.instance.network.received_bytes_count.value`*::
27886+
*`gcp.compute.instance.memory.balloon.ram_used.value`*::
2789227887
+
2789327888
--
27894-
Count of bytes received from the network
27889+
Memory currently used in the VM. This metric is only available for VMs that belong to the e2 family.
2789527890

2789627891
type: long
2789727892

2789827893
--
2789927894

27900-
*`gcp.compute.instance.network.received_packets_count.value`*::
27895+
*`gcp.compute.instance.memory.balloon.swap_in_bytes_count.value`*::
2790127896
+
2790227897
--
27903-
Count of packets received from the network
27898+
The amount of memory read into the guest from its own swap space. This metric is only available for VMs that belong to the e2 family.
2790427899

2790527900
type: long
2790627901

2790727902
--
2790827903

27909-
*`gcp.compute.instance.network.sent_bytes_count.value`*::
27904+
*`gcp.compute.instance.memory.balloon.swap_out_bytes_count.value`*::
2791027905
+
2791127906
--
27912-
Count of bytes sent over the network
27907+
The amount of memory written from the guest to its own swap space. This metric is only available for VMs that belong to the e2 family.
2791327908

2791427909
type: long
2791527910

2791627911
--
2791727912

27918-
*`gcp.compute.instance.network.sent_packets_count.value`*::
27913+
*`gcp.compute.instance.network.received_bytes_count.value`*::
2791927914
+
2792027915
--
27921-
Count of packets sent over the network
27916+
Count of bytes received from the network
2792227917

2792327918
type: long
2792427919

2792527920
--
2792627921

27922+
*`gcp.compute.instance.network.received_packets_count.value`*::
27923+
+
27924+
--
27925+
Count of packets received from the network
2792727926

27928-
*`gcp.compute.instance.memory.balloon.ram_size.value`*::
27927+
type: long
27928+
27929+
--
27930+
27931+
*`gcp.compute.instance.network.sent_bytes_count.value`*::
2792927932
+
2793027933
--
27931-
The total amount of memory in the VM. This metric is only available for VMs that belong to the e2 family.
27934+
Count of bytes sent over the network
2793227935

2793327936
type: long
2793427937

2793527938
--
2793627939

27937-
*`gcp.compute.instance.memory.balloon.ram_used.value`*::
27940+
*`gcp.compute.instance.network.sent_packets_count.value`*::
2793827941
+
2793927942
--
27940-
Memory currently used in the VM. This metric is only available for VMs that belong to the e2 family.
27943+
Count of packets sent over the network
2794127944

2794227945
type: long
2794327946

2794427947
--
2794527948

27946-
*`gcp.compute.instance.memory.balloon.swap_in_bytes_count.value`*::
27949+
*`gcp.compute.instance.uptime.value`*::
2794727950
+
2794827951
--
27949-
The amount of memory read into the guest from its own swap space. This metric is only available for VMs that belong to the e2 family.
27952+
Number of seconds the VM has been running.
2795027953

2795127954
type: long
2795227955

2795327956
--
2795427957

27955-
*`gcp.compute.instance.memory.balloon.swap_out_bytes_count.value`*::
27958+
*`gcp.compute.instance.uptime_total.value`*::
2795627959
+
2795727960
--
27958-
The amount of memory written from the guest to its own swap space. This metric is only available for VMs that belong to the e2 family.
27961+
Elapsed time since the VM was started, in seconds. Sampled every 60 seconds. After sampling, data is not visible for up to 120 seconds.
2795927962

2796027963
type: long
2796127964

Lines changed: 58 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,62 @@
11
- name: compute
2+
description: Google Cloud Compute metrics
23
release: beta
34
type: group
4-
description: Google Cloud Compute metrics
55
fields:
6-
- name: instance
7-
type: group
8-
fields:
9-
- name: firewall
10-
type: group
11-
fields:
12-
- name: dropped_bytes_count.value
13-
type: long
14-
description: Incoming bytes dropped by the firewall
15-
- name: dropped_packets_count.value
16-
type: long
17-
description: Incoming packets dropped by the firewall
18-
- name: cpu
19-
type: group
20-
fields:
21-
- name: reserved_cores.value
22-
type: double
23-
description: Number of cores reserved on the host of the instance
24-
- name: utilization.value
25-
type: double
26-
description: The fraction of the allocated CPU that is currently in use on the instance
27-
- name: usage_time.value
28-
type: double
29-
description: Usage for all cores in seconds
30-
- name: disk
31-
type: group
32-
fields:
33-
- name: read_bytes_count.value
34-
type: long
35-
description: Count of bytes read from disk
36-
- name: read_ops_count.value
37-
type: long
38-
description: Count of disk read IO operations
39-
- name: write_bytes_count.value
40-
type: long
41-
description: Count of bytes written to disk
42-
- name: write_ops_count.value
43-
type: long
44-
description: Count of disk write IO operations
45-
- name: uptime.value
46-
type: long
47-
description: How long the VM has been running, in seconds
48-
- name: network
49-
type: group
50-
fields:
51-
- name: received_bytes_count.value
52-
type: long
53-
description: Count of bytes received from the network
54-
- name: received_packets_count.value
55-
type: long
56-
description: Count of packets received from the network
57-
- name: sent_bytes_count.value
58-
type: long
59-
description: Count of bytes sent over the network
60-
- name: sent_packets_count.value
61-
type: long
62-
description: Count of packets sent over the network
63-
- name: memory.balloon
64-
type: group
65-
fields:
66-
- name: ram_size.value
67-
type: long
68-
description: The total amount of memory in the VM. This metric is only available for VMs that belong to the e2 family.
69-
- name: ram_used.value
70-
type: long
71-
description: Memory currently used in the VM. This metric is only available for VMs that belong to the e2 family.
72-
- name: swap_in_bytes_count.value
73-
type: long
74-
description: The amount of memory read into the guest from its own swap space. This metric is only available for VMs that belong to the e2 family.
75-
- name: swap_out_bytes_count.value
76-
type: long
77-
description: The amount of memory written from the guest to its own swap space. This metric is only available for VMs that belong to the e2 family.
6+
- name: firewall.dropped_bytes_count.value
7+
type: long
8+
description: Incoming bytes dropped by the firewall
9+
- name: firewall.dropped_packets_count.value
10+
type: long
11+
description: Incoming packets dropped by the firewall
12+
- name: instance.cpu.reserved_cores.value
13+
type: double
14+
description: Number of cores reserved on the host of the instance
15+
- name: instance.cpu.usage_time.value
16+
type: double
17+
description: Usage for all cores in seconds
18+
- name: instance.cpu.utilization.value
19+
type: double
20+
description: The fraction of the allocated CPU that is currently in use on the instance
21+
- name: instance.disk.read_bytes_count.value
22+
type: long
23+
description: Count of bytes read from disk
24+
- name: instance.disk.read_ops_count.value
25+
type: long
26+
description: Count of disk read IO operations
27+
- name: instance.disk.write_bytes_count.value
28+
type: long
29+
description: Count of bytes written to disk
30+
- name: instance.disk.write_ops_count.value
31+
type: long
32+
description: Count of disk write IO operations
33+
- name: instance.memory.balloon.ram_size.value
34+
type: long
35+
description: The total amount of memory in the VM. This metric is only available for VMs that belong to the e2 family.
36+
- name: instance.memory.balloon.ram_used.value
37+
type: long
38+
description: Memory currently used in the VM. This metric is only available for VMs that belong to the e2 family.
39+
- name: instance.memory.balloon.swap_in_bytes_count.value
40+
type: long
41+
description: The amount of memory read into the guest from its own swap space. This metric is only available for VMs that belong to the e2 family.
42+
- name: instance.memory.balloon.swap_out_bytes_count.value
43+
type: long
44+
description: The amount of memory written from the guest to its own swap space. This metric is only available for VMs that belong to the e2 family.
45+
- name: instance.network.received_bytes_count.value
46+
type: long
47+
description: Count of bytes received from the network
48+
- name: instance.network.received_packets_count.value
49+
type: long
50+
description: Count of packets received from the network
51+
- name: instance.network.sent_bytes_count.value
52+
type: long
53+
description: Count of bytes sent over the network
54+
- name: instance.network.sent_packets_count.value
55+
type: long
56+
description: Count of packets sent over the network
57+
- name: instance.uptime.value
58+
type: long
59+
description: Number of seconds the VM has been running.
60+
- name: instance.uptime_total.value
61+
type: long
62+
description: Elapsed time since the VM was started, in seconds. Sampled every 60 seconds. After sampling, data is not visible for up to 120 seconds.

x-pack/metricbeat/module/gcp/compute/compute_integration_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,27 @@ import (
1111
"fmt"
1212
"testing"
1313

14+
"github.com/stretchr/testify/assert"
15+
1416
"github.com/elastic/beats/v7/libbeat/common"
1517
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
1618
"github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp/metrics"
1719
)
1820

21+
func TestFetch(t *testing.T) {
22+
config := metrics.GetConfigForTest(t, "compute")
23+
fmt.Printf("%+v\n", config)
24+
25+
metricSet := mbtest.NewReportingMetricSetV2WithContext(t, config)
26+
events, errs := mbtest.ReportingFetchV2WithContext(metricSet)
27+
if len(errs) > 0 {
28+
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
29+
}
30+
31+
assert.NotEmpty(t, events)
32+
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
33+
}
34+
1935
func TestData(t *testing.T) {
2036
metricPrefixIs := func(metricPrefix string) func(e common.MapStr) bool {
2137
return func(e common.MapStr) bool {

x-pack/metricbeat/module/gcp/compute/manifest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ input:
2424
- "instance/network/sent_bytes_count"
2525
- "instance/network/sent_packets_count"
2626
- "instance/uptime"
27+
- "instance/uptime_total"

0 commit comments

Comments
 (0)