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
commit2a90bdaaec12a3d2157909a2ab8840d81de3c984 (patch)
treeee909debddb869c0ce5b32865ca7d4cbde8ebeac /kamon-core/src/test
parent53e9dc6e7211db5538efc0b915ec6f1881da59ad (diff)
downloadKamon-2a90bdaaec12a3d2157909a2ab8840d81de3c984.tar.gz
Kamon-2a90bdaaec12a3d2157909a2ab8840d81de3c984.tar.bz2
Kamon-2a90bdaaec12a3d2157909a2ab8840d81de3c984.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