Skip to content

Commit

Permalink
[Metricbeat] gcp.storage: uniform metricset's fields (elastic#28372)
Browse files Browse the repository at this point in the history
* gcp.storage: add TestFetch

* gcp.storage: flatten fields

* gcp: update fields

* metricbeat: mage update
  • Loading branch information
endorama authored and wiwen committed Nov 1, 2021
1 parent 4840c7e commit 3f09c63
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
4 changes: 0 additions & 4 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34270,7 +34270,6 @@ type: long
Google Cloud Storage metrics



*`gcp.storage.api.request_count.value`*::
+
--
Expand All @@ -34280,7 +34279,6 @@ type: long

--


*`gcp.storage.authz.acl_based_object_access_count.value`*::
+
--
Expand Down Expand Up @@ -34308,7 +34306,6 @@ type: long

--


*`gcp.storage.network.received_bytes_count.value`*::
+
--
Expand All @@ -34327,7 +34324,6 @@ type: long

--


*`gcp.storage.storage.object_count.value`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/gcp/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 28 additions & 40 deletions x-pack/metricbeat/module/gcp/storage/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
- name: storage
description: Google Cloud Storage metrics
release: beta
type: group
description: Google Cloud Storage metrics
fields:
- name: api
type: group
fields:
- name: request_count.value
type: long
description: Delta count of API calls, grouped by the API method name and response code.
- name: authz
type: group
fields:
- name: acl_based_object_access_count.value
type: long
description: Delta count of requests that result in an object being granted access solely due to object ACLs.
- name: acl_operations_count.value
type: long
description: Usage of ACL operations broken down by type.
- name: object_specific_acl_mutation_count.value
type: long
description: Delta count of changes made to object specific ACLs.
- name: network
type: group
fields:
- name: received_bytes_count.value
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: sent_bytes_count.value
type: long
description: Delta count of bytes sent over the network, grouped by the API method name and response code.
- name: storage
type: group
fields:
- name: object_count.value
type: long
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.
- name: total_byte_seconds.value
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: total_bytes.value
type: long
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.
- name: api.request_count.value
type: long
description: Delta count of API calls, grouped by the API method name and response code.
- name: authz.acl_based_object_access_count.value
type: long
description: Delta count of requests that result in an object being granted access solely due to object ACLs.
- name: authz.acl_operations_count.value
type: long
description: Usage of ACL operations broken down by type.
- name: authz.object_specific_acl_mutation_count.value
type: long
description: Delta count of changes made to object specific ACLs.
- name: network.received_bytes_count.value
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: network.sent_bytes_count.value
type: long
description: Delta count of bytes sent over the network, grouped by the API method name and response code.
- name: storage.object_count.value
type: long
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.
- name: storage.total_byte_seconds.value
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: storage.total_bytes.value
type: long
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.
16 changes: 16 additions & 0 deletions x-pack/metricbeat/module/gcp/storage/storage_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,27 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"

"github.com/elastic/beats/v7/libbeat/common"
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
"github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp/metrics"
)

func TestFetch(t *testing.T) {
config := metrics.GetConfigForTest(t, "storage")
fmt.Printf("%+v\n", config)

metricSet := mbtest.NewReportingMetricSetV2WithContext(t, config)
events, errs := mbtest.ReportingFetchV2WithContext(metricSet)
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}

assert.NotEmpty(t, events)
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
}

func TestData(t *testing.T) {
metricPrefixIs := func(metricPrefix string) func(e common.MapStr) bool {
return func(e common.MapStr) bool {
Expand Down

0 comments on commit 3f09c63

Please sign in to comment.