aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego <diegolparra@gmail.com>2014-06-28 13:05:52 -0300
committerDiego <diegolparra@gmail.com>2014-06-28 13:05:52 -0300
commit345b195782adc825cc4f97eb8d1c87ea22d1d0f9 (patch)
tree6b4b043ef92d4a1661e929520de0e6dd04d50175
parent0279260cde60505f311aeed08b4706a4dc6fded0 (diff)
downloadKamon-345b195782adc825cc4f97eb8d1c87ea22d1d0f9.tar.gz
Kamon-345b195782adc825cc4f97eb8d1c87ea22d1d0f9.tar.bz2
Kamon-345b195782adc825cc4f97eb8d1c87ea22d1d0f9.zip
= kamon-examples: updated play example with the TraceName Action
-rw-r--r--kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala13
-rw-r--r--kamon-examples/kamon-play-example/conf/routes3
2 files changed, 14 insertions, 2 deletions
diff --git a/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala b/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
index e5fd78b0..62e36c16 100644
--- a/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
+++ b/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
@@ -15,6 +15,7 @@
* ========================================================== */
package controllers
+import kamon.play.action.TraceName
import play.api.Logger
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.mvc.{Action, Controller}
@@ -40,10 +41,20 @@ object KamonPlayExample extends Controller {
val logger = Logger(this.getClass)
- def sayHelloKamon() = Action.async {
+ def sayHello() = Action.async {
Future {
logger.info("Say hello to Kamon")
Ok("Say hello to Kamon")
}
}
+
+ //using the Kamon TraceName Action to rename the trace name in metrics
+ def sayHelloWithTraceName() = TraceName("my-trace-name") {
+ Action.async {
+ Future {
+ logger.info("Say hello to Kamon")
+ Ok("Say hello to Kamon")
+ }
+ }
+ }
}
diff --git a/kamon-examples/kamon-play-example/conf/routes b/kamon-examples/kamon-play-example/conf/routes
index 6c7733cc..122c355a 100644
--- a/kamon-examples/kamon-play-example/conf/routes
+++ b/kamon-examples/kamon-play-example/conf/routes
@@ -1,2 +1,3 @@
# Routes
-GET /helloKamon controllers.KamonPlayExample.sayHelloKamon \ No newline at end of file
+GET /helloKamon controllers.KamonPlayExample.sayHello
+GET /helloKamonWithTraceName controllers.KamonPlayExample.sayHelloWithTraceName \ No newline at end of file