|
@@ -14,8 +14,10 @@
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
* See the License for the specific language governing permissions and
|
|
|
* limitations under the License.
|
|
|
+ = GenericTestUtils.getTestDir("dfs").getAbsolutePath() + File.separator;
|
|
|
+
|
|
|
*/
|
|
|
-package org.apache.hadoop.ozone.container.common.transport.server.ratis;
|
|
|
+ package org.apache.hadoop.ozone.container.common.transport.server.ratis;
|
|
|
|
|
|
import static org.apache.hadoop.test.MetricsAsserts.assertCounter;
|
|
|
import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
|
|
@@ -29,9 +31,9 @@ import org.apache.hadoop.hdds.client.BlockID;
|
|
|
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
|
|
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
|
|
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos
|
|
|
- .ContainerCommandRequestProto;
|
|
|
+ .ContainerCommandRequestProto;
|
|
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos
|
|
|
- .ContainerCommandResponseProto;
|
|
|
+ .ContainerCommandResponseProto;
|
|
|
import org.apache.hadoop.hdds.scm.*;
|
|
|
import org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException;
|
|
|
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
|
|
@@ -42,7 +44,7 @@ import org.apache.hadoop.ozone.container.ContainerTestHelper;
|
|
|
import org.apache.hadoop.ozone.container.common.interfaces.ContainerDispatcher;
|
|
|
import org.apache.hadoop.ozone.container.common.interfaces.Handler;
|
|
|
import org.apache.hadoop.ozone.container.common.transport.server
|
|
|
- .XceiverServerSpi;
|
|
|
+ .XceiverServerSpi;
|
|
|
import org.apache.hadoop.ozone.web.utils.OzoneUtils;
|
|
|
import org.apache.hadoop.test.GenericTestUtils;
|
|
|
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
|
@@ -57,13 +59,11 @@ import java.util.function.BiConsumer;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.Assert;
|
|
|
|
|
|
-/**
|
|
|
- * This class tests the metrics of ContainerStateMachine.
|
|
|
- */
|
|
|
-public class TestCSMMetrics {
|
|
|
- static final String TEST_DIR
|
|
|
- = GenericTestUtils.getTestDir("dfs").getAbsolutePath() + File.separator;
|
|
|
-
|
|
|
+ /**
|
|
|
+ * This class tests the metrics of ContainerStateMachine.
|
|
|
+ */
|
|
|
+ public class TestCSMMetrics {
|
|
|
+ static final String TEST_DIR
|
|
|
@FunctionalInterface
|
|
|
interface CheckedBiFunction<LEFT, RIGHT, OUT, THROWABLE extends Throwable> {
|
|
|
OUT apply(LEFT left, RIGHT right) throws THROWABLE;
|
|
@@ -112,6 +112,8 @@ public class TestCSMMetrics {
|
|
|
assertCounter("NumWriteStateMachineOps", 0L, metric);
|
|
|
assertCounter("NumReadStateMachineOps", 0L, metric);
|
|
|
assertCounter("NumApplyTransactionOps", 0L, metric);
|
|
|
+ assertCounter("NumBytesWrittenCount", 0L, metric);
|
|
|
+ assertCounter("NumBytesCommittedCount", 0L, metric);
|
|
|
|
|
|
// Write Chunk
|
|
|
BlockID blockID = ContainerTestHelper.getTestBlockID(ContainerTestHelper.
|
|
@@ -127,7 +129,9 @@ public class TestCSMMetrics {
|
|
|
metric = getMetrics(CSMMetrics.SOURCE_NAME +
|
|
|
RaftGroupId.valueOf(pipeline.getId().getId()).toString());
|
|
|
assertCounter("NumWriteStateMachineOps", 1L, metric);
|
|
|
+ assertCounter("NumBytesWrittenCount", 1024L, metric);
|
|
|
assertCounter("NumApplyTransactionOps", 1L, metric);
|
|
|
+ assertCounter("NumBytesCommittedCount", 1024L, metric);
|
|
|
|
|
|
//Read Chunk
|
|
|
ContainerProtos.ContainerCommandRequestProto readChunkRequest =
|
|
@@ -139,7 +143,7 @@ public class TestCSMMetrics {
|
|
|
|
|
|
metric = getMetrics(CSMMetrics.SOURCE_NAME +
|
|
|
RaftGroupId.valueOf(pipeline.getId().getId()).toString());
|
|
|
- assertCounter("NumReadStateMachineOps", 1L, metric);
|
|
|
+ assertCounter("NumQueryStateMachineOps", 1L, metric);
|
|
|
assertCounter("NumApplyTransactionOps", 1L, metric);
|
|
|
} finally {
|
|
|
if (client != null) {
|