pkuwm commented on a change in pull request #1059: URL: https://github.com/apache/helix/pull/1059#discussion_r439729993
########## File path: helix-core/src/main/java/org/apache/helix/monitoring/metrics/AbnormalStatesMetricCollector.java ########## @@ -0,0 +1,63 @@ +package org.apache.helix.monitoring.metrics; + +/* + * 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. + */ + +import javax.management.JMException; + +import org.apache.helix.HelixException; +import org.apache.helix.monitoring.mbeans.MonitorDomainNames; +import org.apache.helix.monitoring.metrics.implementation.RebalanceCounter; +import org.apache.helix.monitoring.metrics.model.CountMetric; + +public class AbnormalStatesMetricCollector extends MetricCollector { + private static final String ABNORMAL_STATES_ENTITY_NAME = "AbnormalStates"; + + public enum AbnormalStatesMetricNames { + // The counter of the partitions that contains abnormal state. Review comment: Nit, maybe javadoc style `/** comment */` so the comments would be shown in javadoc where it is supposed to be, as I see this as public and external user could see the javadoc? If you expect to expose the comments in javadoc ########## File path: helix-core/src/test/java/org/apache/helix/controller/rebalancer/constraint/TestAbnormalStatesResolverMonitor.java ########## @@ -0,0 +1,89 @@ +package org.apache.helix.controller.rebalancer.constraint; + +/* + * 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. + */ + +import java.lang.management.ManagementFactory; +import java.util.Random; +import javax.management.AttributeNotFoundException; +import javax.management.InstanceNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.ReflectionException; + +import org.apache.helix.model.MasterSlaveSMD; +import org.apache.helix.monitoring.mbeans.MonitorDomainNames; +import org.apache.helix.monitoring.metrics.AbnormalStatesMetricCollector; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class TestAbnormalStatesResolverMonitor { + private static final MBeanServer MBEAN_SERVER = ManagementFactory.getPlatformMBeanServer(); + + @Test + public void testMonitorResolver() + throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, + ReflectionException, InstanceNotFoundException { + final String clusterName = "TestCluster"; + + final String TEST_RESOLVER_MONITOR_MBEAN_NAME = String Review comment: Just curious. Why do you use this constant style var name for the local var even it is final? ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
