-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{finagle-core,util-stats}: Move LoadedStatsReceiver to util-stats fro…
…m finagle-core Problem Putting LoadedStatsReceiver in finagle-core means that some things that finagle-core depends on can't use LoadedStatsReceiver. Solution Let's push it down to util-stats, the only additional dependency we need is util-stats => util-app. JIRA Issues: CSL-11393 Differential Revision: https://phabricator.twitter.biz/D763497
- Loading branch information
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
util-stats/src/main/scala/com/twitter/finagle/stats/LoadedStatsReceiver.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.twitter.finagle.stats | ||
|
||
import com.twitter.app.LoadService | ||
|
||
/** | ||
* A [[com.twitter.finagle.stats.StatsReceiver]] that loads | ||
* all service-loadable receivers and broadcasts stats to them. | ||
*/ | ||
object LoadedStatsReceiver extends StatsReceiverProxy { | ||
|
||
/** | ||
* Mutating this value at runtime after it has been initialized should be done | ||
* with great care. If metrics have been created using the prior | ||
* [[StatsReceiver]], updates to those metrics may not be reflected in the | ||
* [[StatsReceiver]] that replaces it. In addition, histograms created with | ||
* the prior [[StatsReceiver]] will not be available. | ||
*/ | ||
@volatile var self: StatsReceiver = BroadcastStatsReceiver(LoadService[StatsReceiver]()) | ||
} | ||
|
||
/** | ||
* A "default" StatsReceiver loaded by the | ||
* [[com.twitter.finagle.util.LoadService]] mechanism. | ||
*/ | ||
object DefaultStatsReceiver extends StatsReceiverProxy { | ||
def self: StatsReceiver = LoadedStatsReceiver | ||
override def repr: DefaultStatsReceiver.type = this | ||
|
||
def get: StatsReceiver = this | ||
} |