aboutsummaryrefslogtreecommitdiff
path: root/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
diff options
context:
space:
mode:
Diffstat (limited to 'kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala')
-rw-r--r--kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala49
1 files changed, 49 insertions, 0 deletions
diff --git a/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala b/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
new file mode 100644
index 00000000..e5fd78b0
--- /dev/null
+++ b/kamon-examples/kamon-play-example/app/controllers/KamonPlayExample.scala
@@ -0,0 +1,49 @@
+/* ===================================================
+ * Copyright © 2013-2014 the kamon project <http://kamon.io/>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+package controllers
+
+import play.api.Logger
+import play.api.libs.concurrent.Execution.Implicits.defaultContext
+import play.api.mvc.{Action, Controller}
+
+import scala.concurrent._
+
+/*
+
+curl -i -H 'X-Trace-Token:kamon-test' -H 'MyTraceLocalStorageKey:extra-header' -X GET "http://localhost:9000/helloKamon"
+
+we should get:
+
+HTTP/1.1 200 OK
+Content-Type: text/plain; charset=utf-8
+MyTraceLocalStorageKey: extra-header -> Extra Information
+X-Trace-Token: kamon-test -> default Trace-Token
+Content-Length: 18
+
+Say hello to Kamon
+
+ */
+object KamonPlayExample extends Controller {
+
+ val logger = Logger(this.getClass)
+
+ def sayHelloKamon() = Action.async {
+ Future {
+ logger.info("Say hello to Kamon")
+ Ok("Say hello to Kamon")
+ }
+ }
+}