Skip to content

Commit d6f4bf7

Browse files
committed
[Metricbeat] gcp.storage: uniform metricset's fields (#28372)
* gcp.storage: add TestFetch * gcp.storage: flatten fields * gcp: update fields * metricbeat: mage update (cherry picked from commit 4229ede)
1 parent 9ac3d75 commit d6f4bf7

4 files changed

Lines changed: 45 additions & 45 deletions

File tree

metricbeat/docs/fields.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28948,7 +28948,6 @@ type: long
2894828948
Google Cloud Storage metrics
2894928949

2895028950

28951-
2895228951
*`gcp.storage.api.request_count.value`*::
2895328952
+
2895428953
--
@@ -28958,7 +28957,6 @@ type: long
2895828957

2895928958
--
2896028959

28961-
2896228960
*`gcp.storage.authz.acl_based_object_access_count.value`*::
2896328961
+
2896428962
--
@@ -28986,7 +28984,6 @@ type: long
2898628984

2898728985
--
2898828986

28989-
2899028987
*`gcp.storage.network.received_bytes_count.value`*::
2899128988
+
2899228989
--
@@ -29005,7 +29002,6 @@ type: long
2900529002

2900629003
--
2900729004

29008-
2900929005
*`gcp.storage.storage.object_count.value`*::
2901029006
+
2901129007
--

x-pack/metricbeat/module/gcp/fields.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,32 @@
11
- name: storage
2+
description: Google Cloud Storage metrics
23
release: beta
34
type: group
4-
description: Google Cloud Storage metrics
55
fields:
6-
- name: api
7-
type: group
8-
fields:
9-
- name: request_count.value
10-
type: long
11-
description: Delta count of API calls, grouped by the API method name and response code.
12-
- name: authz
13-
type: group
14-
fields:
15-
- name: acl_based_object_access_count.value
16-
type: long
17-
description: Delta count of requests that result in an object being granted access solely due to object ACLs.
18-
- name: acl_operations_count.value
19-
type: long
20-
description: Usage of ACL operations broken down by type.
21-
- name: object_specific_acl_mutation_count.value
22-
type: long
23-
description: Delta count of changes made to object specific ACLs.
24-
- name: network
25-
type: group
26-
fields:
27-
- name: received_bytes_count.value
28-
type: long
29-
description: Delta count of bytes received over the network, grouped by the API method name and response code.
30-
- name: sent_bytes_count.value
31-
type: long
32-
description: Delta count of bytes sent over the network, grouped by the API method name and response code.
33-
- name: storage
34-
type: group
35-
fields:
36-
- name: object_count.value
37-
type: long
38-
description: Total number of objects per bucket, grouped by storage class. This value is measured once per day, and the value is repeated at each sampling interval throughout the day.
39-
- name: total_byte_seconds.value
40-
type: long
41-
description: Delta count of bytes received over the network, grouped by the API method name and response code.
42-
- name: total_bytes.value
43-
type: long
44-
description: Total size of all objects in the bucket, grouped by storage class. This value is measured once per day, and the value is repeated at each sampling interval throughout the day.
6+
- name: api.request_count.value
7+
type: long
8+
description: Delta count of API calls, grouped by the API method name and response code.
9+
- name: authz.acl_based_object_access_count.value
10+
type: long
11+
description: Delta count of requests that result in an object being granted access solely due to object ACLs.
12+
- name: authz.acl_operations_count.value
13+
type: long
14+
description: Usage of ACL operations broken down by type.
15+
- name: authz.object_specific_acl_mutation_count.value
16+
type: long
17+
description: Delta count of changes made to object specific ACLs.
18+
- name: network.received_bytes_count.value
19+
type: long
20+
description: Delta count of bytes received over the network, grouped by the API method name and response code.
21+
- name: network.sent_bytes_count.value
22+
type: long
23+
description: Delta count of bytes sent over the network, grouped by the API method name and response code.
24+
- name: storage.object_count.value
25+
type: long
26+
description: Total number of objects per bucket, grouped by storage class. This value is measured once per day, and the value is repeated at each sampling interval throughout the day.
27+
- name: storage.total_byte_seconds.value
28+
type: long
29+
description: Delta count of bytes received over the network, grouped by the API method name and response code.
30+
- name: storage.total_bytes.value
31+
type: long
32+
description: Total size of all objects in the bucket, grouped by storage class. This value is measured once per day, and the value is repeated at each sampling interval throughout the day.

x-pack/metricbeat/module/gcp/storage/storage_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, "storage")
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 {

0 commit comments

Comments
 (0)