Skip to content

Commit

Permalink
monitor the connector flush config
Browse files Browse the repository at this point in the history
to make it easier to track the effects of changing these values
  • Loading branch information
ornicar committed Sep 25, 2024
1 parent 614315e commit 73f5c5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/scala/Monitor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,10 @@ object Monitor:
val expirable = Kamon.gauge("evalCache.upgrade.expirable").withTag("style", key)
val single = Style("single")
val multi = Style("multi")

object connector:
object flush:
object config:
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()
6 changes: 6 additions & 0 deletions src/main/scala/netty/ActorChannelConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ final private class ActorChannelConnector(
private val interval = intSetting("netty.flush.interval-millis")
private val maxDelay = intSetting("netty.flush.max-delay-millis")
private val flushQ = new java.util.concurrent.ConcurrentLinkedQueue[Channel]()
private val monitor = Monitor.connector.flush

scheduler.scheduleOnce(1 second, () => flush())

scheduler.scheduleWithFixedDelay(1 minute, 1 minute): () =>
monitor.config.step.update(step.get)
monitor.config.interval.update(interval.get)
monitor.config.maxDelay.update(maxDelay.get)

def apply(endpoint: Endpoint, channel: Channel): Unit =
val clientPromise = Promise[Client]()
channel.attr(key.client).set(clientPromise.future)
Expand Down

0 comments on commit 73f5c5a

Please sign in to comment.