Skip to content

Commit

Permalink
finagle-stats: Changed CumulativeGauge to use FuturePool.defaultExecutor
Browse files Browse the repository at this point in the history
Problem

Finagle uses FJPool.commonPool for managing its gauges, which adds an extra
thread pool to worry about.

Solution

It's unlikely that gauge management will be a huge burden, so let's just use
FuturePool#defaultExecutor and call it a day.

JIRA Issues: CSL-8357

Differential Revision: https://phabricator.twitter.biz/D455975
  • Loading branch information
mosesn authored and jenkins committed Mar 30, 2020
1 parent d40a2b5 commit 45d2104
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.twitter.finagle.util.DefaultTimer
import com.twitter.logging.{Level, Logger}
import com.twitter.util.{Future, FuturePool, Time}
import com.twitter.util.lint.{Category, GlobalRules, Issue, Rule}
import java.util.concurrent.Executor
import java.util.concurrent.atomic.LongAdder
import scala.collection.JavaConverters._

Expand Down Expand Up @@ -53,6 +54,12 @@ class MetricsStatsReceiver(val registry: Metrics)
with CollisionTrackingStatsReceiver
with WithHistogramDetails {

/**
* Overrides the executor that manages cumulative gauges to use the same
* executor that backs FuturePool.unboundedPool.
*/
override def executor: Executor = FuturePool.defaultExecutor

import MetricsStatsReceiver._

def this() = this(MetricsStatsReceiver.defaultRegistry)
Expand Down

0 comments on commit 45d2104

Please sign in to comment.