You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/05/27 02:31:12 UTC

[GitHub] [flink] zhijiangW commented on a change in pull request #8485: [FLINK-12555] Introduce an encapsulated metric group layout for shuffle API

zhijiangW commented on a change in pull request #8485: [FLINK-12555] Introduce an encapsulated metric group layout for shuffle API
URL: https://github.com/apache/flink/pull/8485#discussion_r287630954
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/metrics/InputChannelMetrics.java
 ##########
 @@ -72,4 +72,47 @@ public Counter getNumBuffersInLocalCounter() {
 	public Counter getNumBuffersInRemoteCounter() {
 		return numBuffersInRemote;
 	}
+
+	private static class MultiCounterWrapper implements Counter {
+		private final Counter[] counters;
+
+		private MultiCounterWrapper(Counter ... counters) {
+			Preconditions.checkArgument(counters.length > 0);
+			this.counters = counters;
+		}
+
+		@Override
+		public void inc() {
+			for (Counter c : counters) {
+				c.inc();
+			}
+		}
+
+		@Override
+		public void inc(long n) {
+			for (Counter c : counters) {
+				c.inc(n);
+			}
+		}
+
+		@Override
+		public void dec() {
+			for (Counter c : counters) {
+				c.dec();
+			}
+		}
+
+		@Override
+		public void dec(long n) {
+			for (Counter c : counters) {
+				c.dec(n);
+			}
+		}
+
+		@Override
+		public long getCount() {
+			// assume that the counters are not accessed directly elsewhere
 
 Review comment:
   I am not sure whether `getCounter` would be actually used. If used we should keep the return counter as previous structure. That means calling `new InputChannelMetrics(parentGroup, networkGroup) instead?

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


With regards,
Apache Git Services