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 #15917 to 7.x: [Metricbeat] Add dedot for cloudwatch metric name #15918

Merged
merged 1 commit into from
Jan 29, 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 @@ -113,6 +113,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix CPU count in docker/cpu in cases where no `online_cpus` are reported {pull}15070[15070]
- Add dedot for tags in ec2 metricset and cloudwatch metricset. {issue}15843[15843] {pull}15844[15844]
- Use RFC3339 format for timestamps collected using the SQL module. {pull}15847[15847]
- Add dedot for cloudwatch metric name. {issue}15916[15916] {pull}15917[15917]

*Packetbeat*

Expand Down
3 changes: 2 additions & 1 deletion x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ func generateFieldName(namespace string, labels []string) string {
// Check if statistic method is one of Sum, SampleCount, Minimum, Maximum, Average
// With checkStatistics function, no need to check bool return value here
statMethod, _ := statisticLookup(stat)
return "aws." + stripNamespace(namespace) + ".metrics." + labels[metricNameIdx] + "." + statMethod
// By default, replace dot "." using under bar "_" for metric names
return "aws." + stripNamespace(namespace) + ".metrics." + common.DeDot(labels[metricNameIdx]) + "." + statMethod
}

// stripNamespace converts Cloudwatch namespace into the root field we will use for metrics
Expand Down
6 changes: 6 additions & 0 deletions x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ func TestGenerateFieldName(t *testing.T) {
[]string{"CPUUtilization", "AWS/EC2", "p10", "InstanceId", "i-1"},
"aws.ec2.metrics.CPUUtilization.p10",
},
{
"test metric name with dot",
"cloudwatch",
[]string{"DeliveryToS3.Records", "AWS/Firehose", "Average", "DeliveryStreamName", "test-1"},
"aws.firehose.metrics.DeliveryToS3_Records.avg",
},
}

for _, c := range cases {
Expand Down