aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2014-07-08 23:06:42 -0300
committerIvan Topolnjak <ivantopo@gmail.com>2014-07-08 23:06:42 -0300
commit7c68d6324cfca0e88c1cd49e9c65b69f68edf55a (patch)
tree038f98855931489eb439c13419a38a60a2c389be /kamon-core/src/test
parentabaebea16ae227929d826059be39d95cd7247baf (diff)
downloadKamon-7c68d6324cfca0e88c1cd49e9c65b69f68edf55a.tar.gz
Kamon-7c68d6324cfca0e88c1cd49e9c65b69f68edf55a.tar.bz2
Kamon-7c68d6324cfca0e88c1cd49e9c65b69f68edf55a.zip
+ core: create the new KamonStandalone helper, closes #47
Diffstat (limited to 'kamon-core/src/test')
-rw-r--r--kamon-core/src/test/scala/kamon/metric/UserMetricsSpec.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/kamon-core/src/test/scala/kamon/metric/UserMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metric/UserMetricsSpec.scala
index 1790dc51..385c8404 100644
--- a/kamon-core/src/test/scala/kamon/metric/UserMetricsSpec.scala
+++ b/kamon-core/src/test/scala/kamon/metric/UserMetricsSpec.scala
@@ -112,6 +112,29 @@ class UserMetricsSpec extends TestKitBase with WordSpecLike with Matchers with I
}
}
+ "allow unregistering metrics from the extension" in {
+ val userMetricsRecorder = Kamon(Metrics).register(UserMetrics, UserMetrics.Factory).get
+ val counter = Kamon(UserMetrics).registerCounter("counter-for-remove")
+ val histogram = Kamon(UserMetrics).registerHistogram("histogram-for-remove")
+ val minMaxCounter = Kamon(UserMetrics).registerMinMaxCounter("min-max-counter-for-remove")
+ val gauge = Kamon(UserMetrics).registerGauge("gauge-for-remove") { () ⇒ 2L }
+
+ userMetricsRecorder.counters.keys should contain("counter-for-remove")
+ userMetricsRecorder.histograms.keys should contain("histogram-for-remove")
+ userMetricsRecorder.minMaxCounters.keys should contain("min-max-counter-for-remove")
+ userMetricsRecorder.gauges.keys should contain("gauge-for-remove")
+
+ Kamon(UserMetrics).removeCounter("counter-for-remove")
+ Kamon(UserMetrics).removeHistogram("histogram-for-remove")
+ Kamon(UserMetrics).removeMinMaxCounter("min-max-counter-for-remove")
+ Kamon(UserMetrics).removeGauge("gauge-for-remove")
+
+ userMetricsRecorder.counters.keys should not contain ("counter-for-remove")
+ userMetricsRecorder.histograms.keys should not contain ("histogram-for-remove")
+ userMetricsRecorder.minMaxCounters.keys should not contain ("min-max-counter-for-remove")
+ userMetricsRecorder.gauges.keys should not contain ("gauge-for-remove")
+ }
+
"generate a snapshot containing all the registered user metrics and reset all instruments" in {
val context = Kamon(Metrics).buildDefaultCollectionContext
val userMetricsRecorder = Kamon(Metrics).register(UserMetrics, UserMetrics.Factory).get