From 596437c25bcd3c581844b33cc77a9d254a47a22e Mon Sep 17 00:00:00 2001 From: Sergiy Prydatchenko Date: Mon, 20 Feb 2017 17:46:11 +0200 Subject: [PATCH] AdaptiveAllocationStrategy: Add ability to count only specific commands, add traffic metrics by command types --- .../cluster/AdaptiveAllocationStrategy.scala | 7 +++++-- .../scala/com/evolutiongaming/cluster/DoNotCount.scala | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/main/scala/com/evolutiongaming/cluster/DoNotCount.scala diff --git a/src/main/scala/com/evolutiongaming/cluster/AdaptiveAllocationStrategy.scala b/src/main/scala/com/evolutiongaming/cluster/AdaptiveAllocationStrategy.scala index fe6f4f9..f656d14 100644 --- a/src/main/scala/com/evolutiongaming/cluster/AdaptiveAllocationStrategy.scala +++ b/src/main/scala/com/evolutiongaming/cluster/AdaptiveAllocationStrategy.scala @@ -55,8 +55,11 @@ class AdaptiveAllocationStrategy( override def extractShardId(numberOfShards: Int): ShardRegion.ExtractShardId = { case x: ClusterMsg => if (!x.isInstanceOf[PersistenceQuery]) { - increment(typeName, x.id) - metricRegistry.meter(s"persistence.$typeName.sender.${x.id}.$selfHost").mark() + if (!x.isInstanceOf[DoNotCount]) { + increment(typeName, x.id) + metricRegistry.meter(s"persistence.$typeName.sender.${ x.id }.$selfHost").mark() + } + metricRegistry.meter(s"persistence.$typeName.command.${ x.id }.${x.getClass.getCanonicalName}.$selfHost").mark() } x.id } diff --git a/src/main/scala/com/evolutiongaming/cluster/DoNotCount.scala b/src/main/scala/com/evolutiongaming/cluster/DoNotCount.scala new file mode 100644 index 0000000..6c86722 --- /dev/null +++ b/src/main/scala/com/evolutiongaming/cluster/DoNotCount.scala @@ -0,0 +1,3 @@ +package com.evolutiongaming.cluster + +trait DoNotCount \ No newline at end of file