You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2021/04/12 17:25:00 UTC

[GitHub] [helix] zhangmeng916 opened a new pull request #1696: Change participant message monitor from static metric to dynamic metric

zhangmeng916 opened a new pull request #1696:
URL: https://github.com/apache/helix/pull/1696


   ### Issues
   
   - [X] My PR addresses the following Helix issues and references them in the PR description:
   Fixed #1683 
   
   ### Description
   
   - [X] Here are some details about my PR, including screenshots of any UI changes:
   
   ParticipantMessageMonitor used a static metric implementation. To uniform our metrics in Helix-core, we would like to convert all static metrics to dynamic metric framework. The PR serves as an example for this cleanup work.
   
   ### Tests
   
   - [X] The following tests are written for this issue:
   
   testReportMessageData
   
   - The following is the result of the "mvn test" command on the appropriate module:
   
   helix-core:
   [ERROR] Failures:
   [ERROR]   TestPauseSignal.testPauseSignal:106 expected:<true> but was:<false>
   [ERROR]   TestDistributedControllerManager.simpleSessionExpiryTest:181->expireController:125 expected:<true> but was:<false>
   [INFO]
   [ERROR] Tests run: 1265, Failures: 2, Errors: 0, Skipped: 0
   [INFO]
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 01:36 h
   [INFO] Finished at: 2021-04-06T16:56:00-07:00
   [INFO] Final Memory: 28M/647M
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
zhangmeng916 commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612748180



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitorMBean.java
##########
@@ -21,7 +20,7 @@
 
 import org.apache.helix.monitoring.SensorNameProvider;
 
-
+@Deprecated

Review comment:
       Would like to keep a record. No need? No other usage at all.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612715613



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitorMBean.java
##########
@@ -21,7 +20,7 @@
 
 import org.apache.helix.monitoring.SensorNameProvider;
 
-
+@Deprecated

Review comment:
       I think you can juat remove it, any other usages?

##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantStatusMonitor.java
##########
@@ -115,42 +122,36 @@ public void reportTransitionStat(StateTransitionContext cxt, StateTransitionData
   }
 
   private ObjectName getObjectName(String name) throws MalformedObjectNameException {
-    return new ObjectName(String.format("%s:%s", MonitorDomainNames.CLMParticipantReport.name(), name));
+    return new ObjectName(
+        String.format("%s:%s", MonitorDomainNames.CLMParticipantReport.name(), name));
   }
 
-  private void register(Object bean, ObjectName name) {
-    LOG.info("Registering bean: " + name.toString());
-    if (_beanServer == null) {
-      LOG.warn("bean server is null, skip reporting");
-      return;
-    }
-    try {
-      _beanServer.unregisterMBean(name);
-    } catch (Exception e1) {
-      // Swallow silently
-    }
-
-    try {
-      _beanServer.registerMBean(bean, name);
-    } catch (Exception e) {
-      LOG.warn("Could not register MBean", e);
-    }
+  /**
+   * Build participant bean name
+   * @param participantName
+   * @return participant bean name
+   */
+  protected String getParticipantBeanName(String participantName) {
+    return String.format("%s=%s", PARTICIPANT_KEY, participantName);
   }
 
   public void shutDown() {
     if (_messageMonitor != null) {  // is participant

Review comment:
       These are not necessary anymore, right? Since you added the unregister() call below for _messageMonitor.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612781506



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitorMBean.java
##########
@@ -21,7 +20,7 @@
 
 import org.apache.helix.monitoring.SensorNameProvider;
 
-
+@Deprecated

Review comment:
       Let's remove it. This is 100% dead code. Leaving it in the repo will cause much confusing.

##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitorMBean.java
##########
@@ -21,7 +20,7 @@
 
 import org.apache.helix.monitoring.SensorNameProvider;
 
-
+@Deprecated

Review comment:
       Let's remove it. This is 100% dead code. Leaving it in the repo will cause much confusion.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 merged pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
zhangmeng916 merged pull request #1696:
URL: https://github.com/apache/helix/pull/1696


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] dasahcc commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
dasahcc commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612631228



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitor.java
##########
@@ -19,10 +19,27 @@
  * under the License.
  */
 
-public class ParticipantMessageMonitor implements ParticipantMessageMonitorMBean {
-  public static final String PARTICIPANT_KEY = "ParticipantName";
+import java.util.ArrayList;
+import java.util.List;

Review comment:
       Question: was this formatted? If yes, then our formatter has problem.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
zhangmeng916 commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612634858



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitor.java
##########
@@ -19,10 +19,27 @@
  * under the License.
  */
 
-public class ParticipantMessageMonitor implements ParticipantMessageMonitorMBean {
-  public static final String PARTICIPANT_KEY = "ParticipantName";
+import java.util.ArrayList;
+import java.util.List;

Review comment:
       Yes, it's formatted by `helix-style-intellij.xml`. What problem do you think we have here?




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 commented on pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
zhangmeng916 commented on pull request #1696:
URL: https://github.com/apache/helix/pull/1696#issuecomment-821281764


   This PR is ready to be merged. Approved by @dasahcc 
   Final commit message:
   Change participant message monitor from static metric to dynamic metric


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on a change in pull request #1696: Change participant message monitor from static metric to dynamic metric

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #1696:
URL: https://github.com/apache/helix/pull/1696#discussion_r612714298



##########
File path: helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ParticipantMessageMonitor.java
##########
@@ -19,10 +19,27 @@
  * under the License.
  */
 
-public class ParticipantMessageMonitor implements ParticipantMessageMonitorMBean {
-  public static final String PARTICIPANT_KEY = "ParticipantName";
+import java.util.ArrayList;
+import java.util.List;

Review comment:
       It seems good to me. @dasahcc, it is javax below, not java. If this is what concerns you : )




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org