milleruntime commented on a change in pull request #1536: Improve master metrics rported via hadoop metrics URL: https://github.com/apache/accumulo/pull/1536#discussion_r385789086
########## File path: test/src/main/java/org/apache/accumulo/test/functional/MasterMetricsIT.java ########## @@ -0,0 +1,372 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, 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. + */ +package org.apache.accumulo.test.functional; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.harness.AccumuloClusterHarness; +import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; +import org.apache.accumulo.test.metrics.MetricsFileTailer; +import org.apache.accumulo.test.util.SlowOps; +import org.apache.hadoop.conf.Configuration; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Functional test that uses a hadoop metrics 2 file sink to read published metrics for + * verification. + */ +public class MasterMetricsIT extends AccumuloClusterHarness { + + private static final Logger log = LoggerFactory.getLogger(MasterMetricsIT.class); + + private static final int NUM_TAIL_ATTEMPTS = 20; + private static final long TAIL_DELAY = 5_000; + + // number of tables / concurrent compactions used during testing. + private final int tableCount = 4; + + private long maxWait; + + private static final Set<String> REQUIRED_METRIC_KEYS = + new HashSet<>(Arrays.asList("currentFateOps", "totalFateOps", "totalZkConnErrors", + "FateTxState_NEW", "FateTxState_IN_PROGRESS", "FateTxState_FAILED_IN_PROGRESS", + "FateTxState_FAILED", "FateTxState_SUCCESSFUL", "FateTxState_UNKNOWN")); + + private static final Set<String> OPTIONAL_METRIC_KEYS = + new HashSet<>(Collections.singletonList("FateTxOpType_CompactRange")); + + private MetricsFileTailer metricsTail = null; + + /** + * MANUAL TESTS ONLY - forces pause to allow jconsole connection + */ + private final boolean PAUSE_FOR_MANUAL_TEST = false; + + @Override + public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { + cfg.setProperty(Property.GENERAL_LEGACY_METRICS, "false"); + cfg.setProperty(Property.MASTER_FATE_METRICS_ENABLED, "true"); + } + + @Before + public void setup() { + + if (testDisabled()) { + return; + } + + // accumuloClient = Accumulo.newClient().from(getClientProps()).build(); Review comment: A glimpse into the future?? Haha ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
