Skip to content

Commit 685d85c

Browse files
author
kaiyan-sheng
authored
Fix ec2 metricset fields.yml and add integration test (#23726)
1 parent 918ebb3 commit 685d85c

6 files changed

Lines changed: 31 additions & 45 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
499499
- Add stack monitoring section to elasticsearch module documentation {pull}#23286[23286]
500500
- Fix metric grouping for windows/perfmon module {issue}23489[23489] {pull}23505[23505]
501501
- Add check for iis/application_pool metricset for nil worker process id values. {issue}23605[23605] {pull}23647[23647]
502+
- Fix ec2 metricset fields.yml and the integration test {pull}23726[23726]
502503
- Unskip s3_request integration test. {pull}23887[23887]
503504
- Add system.hostfs configuration option for system module. {pull}23831[23831]
504505

metricbeat/docs/fields.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,7 @@ type: scaled_float
23262326

23272327
--
23282328

2329-
*`aws.ec2.diskio.read.ops`*::
2329+
*`aws.ec2.diskio.read.count`*::
23302330
+
23312331
--
23322332
Total completed read operations from all instance store volumes available to the instance in collection period.
@@ -2336,7 +2336,7 @@ type: long
23362336

23372337
--
23382338

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

23472347
--
23482348

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

23572357
--
23582358

2359-
*`aws.ec2.diskio.write.ops_per_sec`*::
2359+
*`aws.ec2.diskio.write.count_per_sec`*::
23602360
+
23612361
--
23622362
Completed write operations per second to all instance store volumes available to the instance in a specified period of time.

x-pack/metricbeat/module/aws/ec2/_meta/fields.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@
7676
type: scaled_float
7777
description: >
7878
Bytes written per second to all instance store volumes available to the instance.
79-
- name: diskio.read.ops
79+
- name: diskio.read.count
8080
type: long
8181
description: >
8282
Total completed read operations from all instance store volumes available to the instance in collection period.
83-
- name: diskio.read.ops_per_sec
83+
- name: diskio.read.count_per_sec
8484
type: long
8585
description: >
8686
Completed read operations per second from all instance store volumes available to the instance in a specified period of time.
87-
- name: diskio.write.ops
87+
- name: diskio.write.count
8888
type: long
8989
description: >
9090
Total completed write operations to all instance store volumes available to the instance in collection period.
91-
- name: diskio.write.ops_per_sec
91+
- name: diskio.write.count_per_sec
9292
type: long
9393
description: >
9494
Completed write operations per second to all instance store volumes available to the instance in a specified period of time.

x-pack/metricbeat/module/aws/ec2/ec2_integration_test.go

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
)
1818

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

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

2928
assert.NotEmpty(t, events)
30-
31-
for _, event := range events {
32-
// RootField
33-
mtest.CheckEventField("service.name", "string", event, t)
34-
mtest.CheckEventField("cloud.availability_zone", "string", event, t)
35-
mtest.CheckEventField("cloud.provider", "string", event, t)
36-
mtest.CheckEventField("cloud.instance.id", "string", event, t)
37-
mtest.CheckEventField("cloud.machine.type", "string", event, t)
38-
mtest.CheckEventField("cloud.provider", "string", event, t)
39-
mtest.CheckEventField("cloud.region", "string", event, t)
40-
mtest.CheckEventField("instance.image.id", "string", event, t)
41-
mtest.CheckEventField("instance.state.name", "string", event, t)
42-
mtest.CheckEventField("instance.state.code", "int", event, t)
43-
mtest.CheckEventField("instance.monitoring.state", "string", event, t)
44-
mtest.CheckEventField("instance.core.count", "int", event, t)
45-
mtest.CheckEventField("instance.threads_per_core", "int", event, t)
46-
47-
// MetricSetField
48-
mtest.CheckEventField("cpu.total.pct", "float", event, t)
49-
mtest.CheckEventField("cpu.credit_usage", "float", event, t)
50-
mtest.CheckEventField("cpu.credit_balance", "float", event, t)
51-
mtest.CheckEventField("cpu.surplus_credit_balance", "float", event, t)
52-
mtest.CheckEventField("cpu.surplus_credits_charged", "float", event, t)
53-
mtest.CheckEventField("network.in.packets", "float", event, t)
54-
mtest.CheckEventField("network.out.packets", "float", event, t)
55-
mtest.CheckEventField("network.in.bytes", "float", event, t)
56-
mtest.CheckEventField("network.out.bytes", "float", event, t)
57-
mtest.CheckEventField("diskio.read.bytes", "float", event, t)
58-
mtest.CheckEventField("diskio.write.bytes", "float", event, t)
59-
mtest.CheckEventField("diskio.read.ops", "float", event, t)
60-
mtest.CheckEventField("diskio.write.ops", "float", event, t)
61-
mtest.CheckEventField("status.check_failed", "int", event, t)
62-
mtest.CheckEventField("status.check_failed_system", "int", event, t)
63-
mtest.CheckEventField("status.check_failed_instance", "int", event, t)
64-
}
29+
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
6530
}
6631

6732
func TestData(t *testing.T) {

x-pack/metricbeat/module/aws/fields.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/metricbeat/module/aws/terraform.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,23 @@ resource "aws_s3_bucket_object" "test" {
4646
bucket = aws_s3_bucket.test.id
4747
content = "something"
4848
}
49+
50+
resource "aws_instance" "test" {
51+
ami = data.aws_ami.latest-amzn.id
52+
monitoring = true
53+
instance_type = "t1.micro"
54+
tags = {
55+
Name = "metricbeat-test"
56+
}
57+
}
58+
59+
data "aws_ami" "latest-amzn" {
60+
most_recent = true
61+
owners = ["amazon"]
62+
filter {
63+
name = "name"
64+
values = [
65+
"amzn2-ami-hvm-*",
66+
]
67+
}
68+
}

0 commit comments

Comments
 (0)