You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "xumanbu (via GitHub)" <gi...@apache.org> on 2023/07/26 08:22:56 UTC

[GitHub] [incubator-uniffle] xumanbu opened a new pull request, #1041: [#640] feat(netty):metric system for netty server

xumanbu opened a new pull request, #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041

   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): support xxx"
        - "[#233] fix: check null before access result in xxx"
        - "[MINOR] refactor: fix typo in variable name"
        - "[MINOR] docs: fix typo in README"
        - "[#255] test: fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. Contributor guidelines:
      https://github.com/apache/incubator-uniffle/blob/master/CONTRIBUTING.md
   3. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   
   add NettyMetrics for StreamSever 
   
   ### Why are the changes needed?
   
   Fix: #640
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   UT
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] xumanbu commented on a diff in pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "xumanbu (via GitHub)" <gi...@apache.org>.
xumanbu commented on code in PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#discussion_r1276256983


##########
common/src/main/java/org/apache/uniffle/common/metrics/NettyMetrics.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.uniffle.common.metrics;
+
+import io.prometheus.client.Counter;
+import io.prometheus.client.Gauge;
+
+public abstract class NettyMetrics extends RPCMetrics {
+
+  private static final String NETTY_ACTIVE_CONNECTION = "netty_active_connection";
+  private static final String NETTY_HANDLE_EXCEPTION = "netty_handle_exception";
+
+  protected Gauge.Child gaugeNettyActiveConn;
+  protected Counter.Child counterNettyException;
+
+  public NettyMetrics(String tags) {
+    super(tags);
+  }
+
+  @Override
+  public void registerGeneralMetrics() {
+    gaugeNettyActiveConn = metricsManager.addLabeledGauge(NETTY_ACTIVE_CONNECTION);
+    counterNettyException = metricsManager.addLabeledCounter(NETTY_HANDLE_EXCEPTION);
+  }
+
+  public void incRequest(String className) {
+    if (isRegistered) {
+      Gauge.Child gauge = gaugeMap.get(className);
+      if (gauge != null) {
+        gauge.inc();
+      }
+      Counter.Child counter = counterMap.get(className);
+      if (counter != null) {
+        counter.inc();
+      }
+    }
+  }
+
+  public void decRequest(String className) {
+    if (isRegistered) {

Review Comment:
   fix it.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi merged pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi merged PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] xumanbu commented on a diff in pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "xumanbu (via GitHub)" <gi...@apache.org>.
xumanbu commented on code in PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#discussion_r1276246841


##########
common/src/main/java/org/apache/uniffle/common/metrics/NettyMetrics.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.uniffle.common.metrics;
+
+import io.prometheus.client.Counter;
+import io.prometheus.client.Gauge;
+
+public abstract class NettyMetrics extends RPCMetrics {
+
+  private static final String NETTY_ACTIVE_CONNECTION = "netty_active_connection";
+  private static final String NETTY_HANDLE_EXCEPTION = "netty_handle_exception";
+
+  protected Gauge.Child gaugeNettyActiveConn;
+  protected Counter.Child counterNettyException;
+
+  public NettyMetrics(String tags) {
+    super(tags);
+  }
+
+  @Override
+  public void registerGeneralMetrics() {
+    gaugeNettyActiveConn = metricsManager.addLabeledGauge(NETTY_ACTIVE_CONNECTION);
+    counterNettyException = metricsManager.addLabeledCounter(NETTY_HANDLE_EXCEPTION);
+  }
+
+  public void incRequest(String className) {
+    if (isRegistered) {

Review Comment:
   good advice. 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#issuecomment-1651377469

   @leixm Could you help me review this pr?


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#issuecomment-1654889314

   +1 LGTM.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on a diff in pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on code in PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#discussion_r1275867988


##########
common/src/main/java/org/apache/uniffle/common/metrics/NettyMetrics.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.uniffle.common.metrics;
+
+import io.prometheus.client.Counter;
+import io.prometheus.client.Gauge;
+
+public abstract class NettyMetrics extends RPCMetrics {
+
+  private static final String NETTY_ACTIVE_CONNECTION = "netty_active_connection";
+  private static final String NETTY_HANDLE_EXCEPTION = "netty_handle_exception";
+
+  protected Gauge.Child gaugeNettyActiveConn;
+  protected Counter.Child counterNettyException;
+
+  public NettyMetrics(String tags) {
+    super(tags);
+  }
+
+  @Override
+  public void registerGeneralMetrics() {
+    gaugeNettyActiveConn = metricsManager.addLabeledGauge(NETTY_ACTIVE_CONNECTION);
+    counterNettyException = metricsManager.addLabeledCounter(NETTY_HANDLE_EXCEPTION);
+  }
+
+  public void incRequest(String className) {
+    if (isRegistered) {
+      Gauge.Child gauge = gaugeMap.get(className);
+      if (gauge != null) {
+        gauge.inc();
+      }
+      Counter.Child counter = counterMap.get(className);
+      if (counter != null) {
+        counter.inc();
+      }
+    }
+  }
+
+  public void decRequest(String className) {
+    if (isRegistered) {

Review Comment:
   ditto.



##########
common/src/main/java/org/apache/uniffle/common/metrics/NettyMetrics.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.uniffle.common.metrics;
+
+import io.prometheus.client.Counter;
+import io.prometheus.client.Gauge;
+
+public abstract class NettyMetrics extends RPCMetrics {
+
+  private static final String NETTY_ACTIVE_CONNECTION = "netty_active_connection";
+  private static final String NETTY_HANDLE_EXCEPTION = "netty_handle_exception";
+
+  protected Gauge.Child gaugeNettyActiveConn;
+  protected Counter.Child counterNettyException;
+
+  public NettyMetrics(String tags) {
+    super(tags);
+  }
+
+  @Override
+  public void registerGeneralMetrics() {
+    gaugeNettyActiveConn = metricsManager.addLabeledGauge(NETTY_ACTIVE_CONNECTION);
+    counterNettyException = metricsManager.addLabeledCounter(NETTY_HANDLE_EXCEPTION);
+  }
+
+  public void incRequest(String className) {
+    if (isRegistered) {

Review Comment:
   Could we reuse RPCMetrics#incCounter? seems same code logic.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #1041: [#640] feat(netty): Metric system for netty server

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #1041:
URL: https://github.com/apache/incubator-uniffle/pull/1041#issuecomment-1653041188

   > @leixm Could you help me review this pr?
   
   Sure.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org