Created
August 4, 2010 23:40
-
-
Save fizx/508984 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| diff --git a/CHANGELOG b/CHANGELOG | |
| new file mode 100644 | |
| index 0000000..e1ae018 | |
| --- /dev/null | |
| +++ b/CHANGELOG | |
| @@ -0,0 +1 @@ | |
| +1.2.0 (August 3, 2010) - Added manual setGauge and clearGauge to Stats. | |
| \ No newline at end of file | |
| diff --git a/project/build.properties b/project/build.properties | |
| index 6cef012..2b7f796 100644 | |
| --- a/project/build.properties | |
| +++ b/project/build.properties | |
| @@ -3,7 +3,7 @@ | |
| project.name=ostrich | |
| project.organization=com.twitter | |
| scala.version=2.7.7 | |
| -project.version=1.1.23 | |
| +project.version=1.2.0 | |
| sbt.version=0.7.3 | |
| build.scala.versions=2.7.7 | |
| project.initialize=false | |
| diff --git a/project/plugins/project/build.properties b/project/plugins/project/build.properties | |
| index 4391320..ee8c574 100644 | |
| --- a/project/plugins/project/build.properties | |
| +++ b/project/plugins/project/build.properties | |
| @@ -1,3 +1,3 @@ | |
| #Project properties | |
| -#Fri Jun 11 15:05:02 PDT 2010 | |
| +#Wed Aug 04 16:21:06 PDT 2010 | |
| plugin.uptodate=true | |
| diff --git a/src/main/scala/com/twitter/ostrich/Stats.scala b/src/main/scala/com/twitter/ostrich/Stats.scala | |
| index aeab753..78e0af8 100644 | |
| --- a/src/main/scala/com/twitter/ostrich/Stats.scala | |
| +++ b/src/main/scala/com/twitter/ostrich/Stats.scala | |
| @@ -51,6 +51,14 @@ object Stats extends StatsProvider { | |
| forkedCollections.foreach { _.addTiming(name, timingStat) } | |
| collection.addTiming(name, timingStat) | |
| } | |
| + | |
| + def setGauge(name: String, value: Double) = { | |
| + gaugeMap += name -> new Gauge { def apply(reset: Boolean) = value } | |
| + } | |
| + | |
| + def clearGauge(name: String) = { | |
| + gaugeMap -= name | |
| + } | |
| def incr(name: String, count: Int): Long = { | |
| forkedCollections.foreach { _.incr(name, count) } | |
| diff --git a/src/test/scala/com/twitter/ostrich/StatsSpec.scala b/src/test/scala/com/twitter/ostrich/StatsSpec.scala | |
| index c9015d8..488764e 100644 | |
| --- a/src/test/scala/com/twitter/ostrich/StatsSpec.scala | |
| +++ b/src/test/scala/com/twitter/ostrich/StatsSpec.scala | |
| @@ -173,6 +173,17 @@ object StatsSpec extends Specification { | |
| Stats.makeGauge("pi") { java.lang.Math.PI } | |
| Stats.getGaugeStats(false) mustEqual Map("pi" -> java.lang.Math.PI) | |
| } | |
| + | |
| + "setGauge" in { | |
| + Stats.setGauge("stew", 11.0) | |
| + Stats.getGaugeStats(true) mustEqual Map("stew" -> 11.0) | |
| + } | |
| + | |
| + "clearGauge" in { | |
| + Stats.setGauge("stew", 11.0) | |
| + Stats.clearGauge("stew") | |
| + Stats.getGaugeStats(true) mustEqual Map() | |
| + } | |
| "update" in { | |
| var potatoes = 100.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ship it!