Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metricbeat] Add storage metricset to Google Cloud Platform module #15598

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Replace vpc metricset into vpn, transitgateway and natgateway metricsets. {pull}16892[16892]
- Release Oracle module as GA. {issue}14279[14279] {pull}16833[16833]
- Release vsphere module as GA. {issue}15798[15798] {pull}17119[17119]
- Add Storage metricsets to GCP module {pull}15598[15598]

*Packetbeat*

Expand Down
12 changes: 12 additions & 0 deletions metricbeat/docs/modules/googlecloud.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ metricbeat.modules:
- pubsub
- loadbalancing
zone: "us-central1-a"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
exclude_labels: false
period: 300s

- module: googlecloud
metricsets:
- storage
region: "us-central1"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
Expand All @@ -122,9 +130,13 @@ The following metricsets are available:

* <<metricbeat-metricset-googlecloud-pubsub,pubsub>>

* <<metricbeat-metricset-googlecloud-storage,storage>>

include::googlecloud/compute.asciidoc[]

include::googlecloud/loadbalancing.asciidoc[]

include::googlecloud/pubsub.asciidoc[]

include::googlecloud/storage.asciidoc[]

23 changes: 23 additions & 0 deletions metricbeat/docs/modules/googlecloud/storage.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
////
This file is generated! See scripts/mage/docs_collector.go
////

[[metricbeat-metricset-googlecloud-storage]]
=== Google Cloud Platform storage metricset

beta[]

include::../../../../x-pack/metricbeat/module/googlecloud/storage/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-googlecloud,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../../x-pack/metricbeat/module/googlecloud/storage/_meta/data.json[]
----
3 changes: 2 additions & 1 deletion metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ This file is generated! See scripts/mage/docs_collector.go
.2+| .2+| |<<metricbeat-metricset-golang-expvar,expvar>>
|<<metricbeat-metricset-golang-heap,heap>>
|<<metricbeat-module-googlecloud,Google Cloud Platform>> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.3+| .3+| |<<metricbeat-metricset-googlecloud-compute,compute>> beta[]
.4+| .4+| |<<metricbeat-metricset-googlecloud-compute,compute>> beta[]
|<<metricbeat-metricset-googlecloud-loadbalancing,loadbalancing>> beta[]
|<<metricbeat-metricset-googlecloud-pubsub,pubsub>> beta[]
|<<metricbeat-metricset-googlecloud-storage,storage>> beta[]
|<<metricbeat-module-graphite,Graphite>> |image:./images/icon-no.png[No prebuilt dashboards] |
.1+| .1+| |<<metricbeat-metricset-graphite-server,server>>
|<<metricbeat-module-haproxy,HAProxy>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
Expand Down
8 changes: 8 additions & 0 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ metricbeat.modules:
- pubsub
- loadbalancing
zone: "us-central1-a"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
exclude_labels: false
period: 300s

- module: googlecloud
metricsets:
- storage
region: "us-central1"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
Expand Down
8 changes: 8 additions & 0 deletions x-pack/metricbeat/module/googlecloud/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
- pubsub
- loadbalancing
zone: "us-central1-a"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
exclude_labels: false
period: 300s

- module: googlecloud
metricsets:
- storage
region: "us-central1"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/googlecloud/fields.go

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

1 change: 1 addition & 0 deletions x-pack/metricbeat/module/googlecloud/module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ metricsets:
- compute
- pubsub
- loadbalancing
- storage
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewMetadataServiceForConfig(c config) (googlecloud.MetadataService, error)
switch c.ServiceName {
case googlecloud.ServiceCompute:
return compute.NewMetadataService(c.ProjectID, c.Zone, c.Region, c.opt...)
case googlecloud.ServicePubsub, googlecloud.ServiceLoadBalancing:
case googlecloud.ServicePubsub, googlecloud.ServiceLoadBalancing, googlecloud.ServiceStorage:
return nil, nil
default:
return nil, errors.Errorf("service '%s' not supported", c.ServiceName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ func (r *stackdriverMetricsRequester) getFilterForMetric(m string) (f string) {
switch service {
case googlecloud.ServicePubsub, googlecloud.ServiceLoadBalancing:
return
case googlecloud.ServiceStorage:
if r.config.Region == "" {
return
}

f = fmt.Sprintf(`%s AND resource.labels.location = "%s"`, f, r.config.Region)
default:
if r.config.Region != "" && r.config.Zone != "" {
r.logger.Warnf("when region %s and zone %s config parameter "+
Expand Down
55 changes: 55 additions & 0 deletions x-pack/metricbeat/module/googlecloud/storage/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"@timestamp": "2020-01-15T19:50:00.000Z",
"@metadata": {
"beat": "metricbeat",
"type": "_doc",
"version": "8.0.0"
},
"ecs": {
"version": "1.4.0"
},
"host": {
"name": "mcastro"
},
"agent": {
"type": "metricbeat",
"ephemeral_id": "b925f861-f858-4aa8-8075-99fc8e86e736",
"hostname": "mcastro",
"id": "7e36a073-1a32-4a94-b65b-4c7f971fb228",
"version": "8.0.0"
},
"metricset": {
"name": "storage",
"period": 300000
},
"googlecloud": {
"labels": {
"metrics": {
"storage_class": "REGIONAL"
},
"resource": {
"location": "us-central1",
"bucket_name": "test-elastic-metricbeat"
}
},
"storage": {
"storage": {
"object_count": 1
Copy link
Member

@ChrsMark ChrsMark Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, since this is being included in the docs it would be nice if we could have more metrics-fields as a more complete sample for our users. I would try to include as many as possible of them https://github.com/elastic/beats/pull/15598/files#diff-71e43a13b3f822a4956f547a646aced4R10.

wdyt?

}
}
},
"service": {
"type": "googlecloud"
},
"cloud": {
"account": {
"id": "elastic-metricbeat"
},
"provider": "googlecloud"
},
"event": {
"dataset": "googlecloud.storage",
"module": "googlecloud",
"duration": 818254385
}
}
18 changes: 18 additions & 0 deletions x-pack/metricbeat/module/googlecloud/storage/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Storage Metricset to fetch metrics from https://cloud.google.com/storage/[Storage] in Google Cloud Platform.

The `storage` Metricset contains all metrics exported from the https://cloud.google.com/monitoring/api/metrics_gcp#gcp-storage[Stackdriver API]. The field names have been left untouched for people already familiar with them.

You can specify a single region to fetch metrics like `us-central1`. Be aware that GCP Storage does not use zones so `us-central1-a` will return nothing. If no region is specified, it will return metrics from all buckets.

[float]
=== Fields

- `storage.api.request_count`: Delta count of API calls, grouped by the API method name and response code.
- `storage.authz.acl_based_object_access_count`: Delta count of requests that result in an object being granted access solely due to object ACLs.
- `storage.authz.acl_operations_count`: Usage of ACL operations broken down by type.
- `storage.authz.object_specific_acl_mutation_count`: Delta count of changes made to object specific ACLs.
- `storage.network.received_bytes_count`: Delta count of bytes received over the network, grouped by the API method name and response code.
- `storage.network.sent_bytes_count`: Delta count of bytes sent over the network, grouped by the API method name and response code.
- `storage.storage.object_count`: 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.
- `storage.storage.total_byte_seconds`: Delta count of bytes received over the network, grouped by the API method name and response code.
- `storage.storage.total_bytes`: 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.
44 changes: 44 additions & 0 deletions x-pack/metricbeat/module/googlecloud/storage/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
- name: storage
release: beta
type: group
description: Google Cloud Storage metrics
fields:
- name: api
type: group
fields:
- name: request_count
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
type: long
description: Delta count of requests that result in an object being granted access solely due to object ACLs.
- name: acl_operations_count
type: long
description: Usage of ACL operations broken down by type.
- name: object_specific_acl_mutation_count
type: long
description: Delta count of changes made to object specific ACLs.
- name: network
type: group
fields:
- name: received_bytes_count
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: sent_bytes_count
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
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
type: long
description: Delta count of bytes received over the network, grouped by the API method name and response code.
- name: total_bytes
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.
17 changes: 17 additions & 0 deletions x-pack/metricbeat/module/googlecloud/storage/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
default: false
input:
module: googlecloud
metricset: stackdriver
defaults:
stackdriver:
service: storage
metrics:
- "storage.googleapis.com/api/request_count"
- "storage.googleapis.com/authz/acl_based_object_access_count"
- "storage.googleapis.com/authz/acl_operations_count"
- "storage.googleapis.com/authz/object_specific_acl_mutation_count"
- "storage.googleapis.com/network/received_bytes_count"
- "storage.googleapis.com/network/sent_bytes_count"
- "storage.googleapis.com/storage/object_count"
- "storage.googleapis.com/storage/total_byte_seconds"
- "storage.googleapis.com/storage/total_bytes"
8 changes: 8 additions & 0 deletions x-pack/metricbeat/modules.d/googlecloud.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
- pubsub
- loadbalancing
zone: "us-central1-a"
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
exclude_labels: false
period: 300s

- module: googlecloud
metricsets:
- storage
region: "us-central1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should compute and storage be in separate config section? Because one is taking zone and the other is taking region as config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that yes 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sayden ^^ WDYT? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overlooked at this the first time but yeap, I think it's better to separate them too. Thanks! 😬

project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
Expand Down