Skip to content

Commit

Permalink
Move s3_daily_storage and s3_request metricsets to use cloudwatch inp…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyan-sheng authored Oct 14, 2020
1 parent c51c70c commit 28ea348
Show file tree
Hide file tree
Showing 18 changed files with 209 additions and 581 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Move Prometheus query & remote_write to GA. {pull}21507[21507]
- Expand unsupported option from namespace to metrics in the azure module. {pull}21486[21486]
- Map cloud data filed `cloud.account.id` to azure subscription. {pull}21483[21483] {issue}21381[21381]
- 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,18 @@ 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)
break
}
}

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

0 comments on commit 28ea348

Please sign in to comment.