From a0cb1e0941a22d3bbbe5476835f7073d854ed074 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 15 May 2018 16:13:56 +0100 Subject: [PATCH] HADOOP-15442. ITestS3AMetrics.testMetricsRegister can't know metrics source's name. Contributed by Sean Mackrory. (cherry picked from commit b6708374692e6c4d786e2f3f1f45cc7aa1e4e88f) --- .../java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java | 3 --- .../test/java/org/apache/hadoop/fs/s3a/ITestS3AMetrics.java | 5 ----- 2 files changed, 8 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java index 29ee0c53106..26ecefd0592 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java @@ -267,9 +267,6 @@ public class S3AInstrumentation implements Closeable, MetricsSource { number = ++metricsSourceNameCounter; } String msName = METRICS_SOURCE_BASENAME + number; - if (number > 1) { - msName = msName + number; - } metricsSourceName = msName + "-" + name.getHost(); metricsSystem.register(metricsSourceName, "", this); } diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AMetrics.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AMetrics.java index e92ce78b101..972c665438e 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AMetrics.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AMetrics.java @@ -38,11 +38,6 @@ public class ITestS3AMetrics extends AbstractS3ATestBase { Path dest = path("testMetricsRegister"); ContractTestUtils.touch(fs, dest); - String targetMetricSource = "S3AMetrics1" + "-" + fs.getBucket(); - assertNotNull("No metrics under test fs for " + targetMetricSource, - fs.getInstrumentation().getMetricsSystem() - .getSource(targetMetricSource)); - MutableCounterLong fileCreated = (MutableCounterLong) fs.getInstrumentation().getRegistry() .get(Statistic.FILES_CREATED.getSymbol());