diff --git a/src/main/scala/Monitor.scala b/src/main/scala/Monitor.scala index 68e612a2..a228bb0b 100644 --- a/src/main/scala/Monitor.scala +++ b/src/main/scala/Monitor.scala @@ -188,3 +188,5 @@ object Monitor: val step = Kamon.gauge("connector.flush.config.step").withoutTags() val interval = Kamon.gauge("connector.flush.config.interval").withoutTags() val maxDelay = Kamon.gauge("connector.flush.config.maxDelay").withoutTags() + val qSize = Kamon.histogram("connector.flush.qSize").withoutTags() + val channelsToFlush = Kamon.histogram("connector.flush.channelsToFlush").withoutTags() diff --git a/src/main/scala/netty/ActorChannelConnector.scala b/src/main/scala/netty/ActorChannelConnector.scala index c0a6d47e..ed61c88e 100644 --- a/src/main/scala/netty/ActorChannelConnector.scala +++ b/src/main/scala/netty/ActorChannelConnector.scala @@ -62,8 +62,12 @@ final private class ActorChannelConnector( flushQ.add(channel) private def flush(): Unit = + val qSize = flushQ.size val maxDelayFactor = maxDelay.get().toDouble / interval.get() - var channelsToFlush = step.get().atLeast((flushQ.size * maxDelayFactor).toInt) + var channelsToFlush = step.get().atLeast((qSize * maxDelayFactor).toInt) + + monitor.qSize.record(qSize) + monitor.channelsToFlush.record(channelsToFlush) while channelsToFlush > 0 do Option(flushQ.poll()) match