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

Fix ec2 metricset fields.yml and add integration test #23726

Merged
merged 12 commits into from
Feb 16, 2021
Merged
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add stack monitoring section to elasticsearch module documentation {pull}#23286[23286]
- Fix metric grouping for windows/perfmon module {issue}23489[23489] {pull}23505[23505]
- Add check for iis/application_pool metricset for nil worker process id values. {issue}23605[23605] {pull}23647[23647]
- Fix ec2 metricset fields.yml and the integration test {pull}23726[23726]
- Add system.hostfs configuration option for system module. {pull}23831[23831]

*Packetbeat*
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ type: long

--

*`aws.ec2.diskio.read.ops_per_sec`*::
*`aws.ec2.diskio.read.count_per_sec`*::
+
--
Completed read operations per second from all instance store volumes available to the instance in a specified period of time.
Expand All @@ -2346,7 +2346,7 @@ type: long

--

*`aws.ec2.diskio.write.ops`*::
*`aws.ec2.diskio.write.count`*::
+
--
Total completed write operations to all instance store volumes available to the instance in collection period.
Expand All @@ -2356,7 +2356,7 @@ type: long

--

*`aws.ec2.diskio.write.ops_per_sec`*::
*`aws.ec2.diskio.write.count_per_sec`*::
+
--
Completed write operations per second to all instance store volumes available to the instance in a specified period of time.
Expand Down
6 changes: 3 additions & 3 deletions x-pack/metricbeat/module/aws/ec2/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
type: long
description: >
Total completed read operations from all instance store volumes available to the instance in collection period.
- name: diskio.read.ops_per_sec
- name: diskio.read.count_per_sec
type: long
description: >
Completed read operations per second from all instance store volumes available to the instance in a specified period of time.
- name: diskio.write.ops
- name: diskio.write.count
type: long
description: >
Total completed write operations to all instance store volumes available to the instance in collection period.
- name: diskio.write.ops_per_sec
- name: diskio.write.count_per_sec
type: long
description: >
Completed write operations per second to all instance store volumes available to the instance in a specified period of time.
Expand Down
37 changes: 1 addition & 36 deletions x-pack/metricbeat/module/aws/ec2/ec2_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

func TestFetch(t *testing.T) {
t.Skip("flaky test: https://github.com/elastic/beats/issues/20951")
config := mtest.GetConfigForTest(t, "ec2", "300s")

metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
Expand All @@ -27,41 +26,7 @@ func TestFetch(t *testing.T) {
}

assert.NotEmpty(t, events)

for _, event := range events {
// RootField
mtest.CheckEventField("service.name", "string", event, t)
mtest.CheckEventField("cloud.availability_zone", "string", event, t)
mtest.CheckEventField("cloud.provider", "string", event, t)
mtest.CheckEventField("cloud.instance.id", "string", event, t)
mtest.CheckEventField("cloud.machine.type", "string", event, t)
mtest.CheckEventField("cloud.provider", "string", event, t)
mtest.CheckEventField("cloud.region", "string", event, t)
mtest.CheckEventField("instance.image.id", "string", event, t)
mtest.CheckEventField("instance.state.name", "string", event, t)
mtest.CheckEventField("instance.state.code", "int", event, t)
mtest.CheckEventField("instance.monitoring.state", "string", event, t)
mtest.CheckEventField("instance.core.count", "int", event, t)
mtest.CheckEventField("instance.threads_per_core", "int", event, t)

// MetricSetField
mtest.CheckEventField("cpu.total.pct", "float", event, t)
mtest.CheckEventField("cpu.credit_usage", "float", event, t)
mtest.CheckEventField("cpu.credit_balance", "float", event, t)
mtest.CheckEventField("cpu.surplus_credit_balance", "float", event, t)
mtest.CheckEventField("cpu.surplus_credits_charged", "float", event, t)
mtest.CheckEventField("network.in.packets", "float", event, t)
mtest.CheckEventField("network.out.packets", "float", event, t)
mtest.CheckEventField("network.in.bytes", "float", event, t)
mtest.CheckEventField("network.out.bytes", "float", event, t)
mtest.CheckEventField("diskio.read.bytes", "float", event, t)
mtest.CheckEventField("diskio.write.bytes", "float", event, t)
mtest.CheckEventField("diskio.read.ops", "float", event, t)
mtest.CheckEventField("diskio.write.ops", "float", event, t)
mtest.CheckEventField("status.check_failed", "int", event, t)
mtest.CheckEventField("status.check_failed_system", "int", event, t)
mtest.CheckEventField("status.check_failed_instance", "int", event, t)
}
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
}

func TestData(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/aws/fields.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions x-pack/metricbeat/module/aws/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ resource "aws_s3_bucket_object" "test" {
bucket = aws_s3_bucket.test.id
content = "something"
}

resource "aws_instance" "test" {
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
ami = data.aws_ami.latest-amzn.id
monitoring = true
instance_type = "t1.micro"
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
tags = {
Name = "metricbeat-test"
}
}

data "aws_ami" "latest-amzn" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = [
"amzn2-ami-hvm-*"]
}
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
}