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

Cherry-pick #21703 to 7.x: Move s3_daily_storage and s3_request metricsets to use cloudwatch input #21821

Merged
merged 3 commits into from
Oct 15, 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 @@ -843,6 +843,7 @@ field. You can revert this change by configuring tags for the module and omittin
- Move Prometheus query & remote_write to GA. {pull}21507[21507]
- Map cloud data filed `cloud.account.id` to azure subscription. {pull}21483[21483] {issue}21381[21381]
- Expand unsupported option from namespace to metrics in the azure module. {pull}21486[21486]
- Move s3_daily_storage and s3_request metricsets to use cloudwatch input. {pull}21703[21703]

*Packetbeat*

Expand Down
1 change: 1 addition & 0 deletions metricbeat/docs/modules/aws/s3_daily_storage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This file is generated! See scripts/mage/docs_collector.go

include::../../../../x-pack/metricbeat/module/aws/s3_daily_storage/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

==== Fields

Expand Down
1 change: 1 addition & 0 deletions metricbeat/docs/modules/aws/s3_request.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This file is generated! See scripts/mage/docs_collector.go

include::../../../../x-pack/metricbeat/module/aws/s3_request/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

==== Fields

Expand Down
2 changes: 0 additions & 2 deletions x-pack/metricbeat/include/list.go

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

2 changes: 2 additions & 0 deletions x-pack/metricbeat/module/aws/module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metricsets:
- ebs
- usage
- sns
- s3_daily_storage
- s3_request
- lambda
- dynamodb
- vpn
Expand Down
1 change: 1 addition & 0 deletions x-pack/metricbeat/module/aws/mtest/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func GetConfigForTest(t *testing.T, metricSetName string, period string) map[str
"access_key_id": accessKeyID,
"secret_access_key": secretAccessKey,
"default_region": defaultRegion,
"latency": "5m",
// You can specify which region to run test on by using regions variable
// "regions": []string{"us-east-1"},
}
Expand Down
27 changes: 14 additions & 13 deletions x-pack/metricbeat/module/aws/s3_daily_storage/_meta/data.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"aws": {
"s3": {
"bucket": {
"name": "test-s3-ks-2"
}
"cloudwatch": {
"namespace": "AWS/S3"
},
"dimensions": {
"BucketName": "filebeat-aws-elb-test",
"StorageType": "AllStorageTypes"
},
"s3_daily_storage": {
"bucket": {
"size": {
"bytes": 207372
"s3": {
"metrics": {
"NumberOfObjects": {
"avg": 57828
}
},
"number_of_objects": 128
}
}
},
"cloud": {
"account": {
"id": "627959692251",
"name": "elastic-test"
"id": "428152502467",
"name": "elastic-beats"
},
"provider": "aws",
"region": "ap-southeast-1"
"region": "eu-central-1"
},
"event": {
"dataset": "aws.s3_daily_storage",
Expand Down
21 changes: 0 additions & 21 deletions x-pack/metricbeat/module/aws/s3_daily_storage/data.go

This file was deleted.

22 changes: 22 additions & 0 deletions x-pack/metricbeat/module/aws/s3_daily_storage/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
default: true
input:
module: aws
metricset: cloudwatch
defaults:
metrics:
- namespace: AWS/S3
statistic: ["Average"]
name:
- BucketSizeBytes
- NumberOfObjects

processors:
- rename:
ignore_missing: true
fields:
- from: "aws.s3.metrics.NumberOfObjects.avg"
to: "aws.s3_daily_storage.number_of_objects"
- from: "aws.s3.metrics.BucketSizeBytes.avg"
to: "aws.s3_daily_storage.bucket.size.bytes"
- from: "aws.dimensions.BucketName"
to: "aws.s3.bucket.name"
219 changes: 0 additions & 219 deletions x-pack/metricbeat/module/aws/s3_daily_storage/s3_daily_storage.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,17 @@ func TestFetch(t *testing.T) {
assert.NotEmpty(t, events)

for _, event := range events {
// RootField
mtest.CheckEventField("service.name", "string", event, t)
mtest.CheckEventField("cloud.region", "string", event, t)

// MetricSetField
mtest.CheckEventField("bucket.name", "string", event, t)
mtest.CheckEventField("bucket.size.bytes", "float", event, t)
mtest.CheckEventField("number_of_objects", "float", event, t)
mtest.CheckEventField("aws.dimensions.BucketName", "string", event, t)
mtest.CheckEventField("aws.dimensions.StorageType", "string", event, t)
mtest.CheckEventField("aws.s3.metrics.BucketSizeBytes.avg", "float", event, t)
mtest.CheckEventField("aws.s3.metrics.NumberOfObjects.avg", "float", event, t)
}
}

func TestData(t *testing.T) {
config := mtest.GetConfigForTest(t, "s3_daily_storage", "86400s")

metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
if err := mbtest.WriteEventsReporterV2Error(metricSet, t, "/"); err != nil {
t.Fatal("write", err)
}
metricSet := mbtest.NewFetcher(t, config)
metricSet.WriteEvents(t, "/")
}
Loading