No metrics when using Kamon with Play and DataDog

801 views
Skip to first unread message

Иакс Меланхович

unread,
Dec 9, 2014, 5:25:29 AM12/9/14
to kamon...@googlegroups.com
Hello.

I'm having problems in configuring Kamon for Play project.

Datadog agent is up and running, I can report custom metrics using nc:

```
echo "test.counter:10|c" | nc -u -w0 127.0.0.1 8125
```

... and see them in Datadog panel.

Here is my application.conf:

```
akka {
extensions = ["kamon.metric.Metrics", "kamon.datadog.Datadog",
"kamon.system.SystemMetrics", "kamon.logreporter.LogReporter"] }

kamon {
metrics {
filters = [
{
actor {
includes = [ "user/*", "user/worker-*" ]
excludes = [ "system/*" ]
}
},
{
trace {
includes = [ "*" ]
excludes = []
}
}
]
}

datadog {
hostname = "127.0.0.1"
port = 8125

flush-interval = 1 second

max-packet-size = 1024 bytes

report-system-metrics = true

includes {
actor = [ "*" ]
trace = [ "*" ]
dispatcher = [ "*" ]
}

application-name = "webadmin"
}

play {
include-trace-token-header = true
trace-token-header-name = "X-Trace-Token"
}
}

# ... other application settings ...
```

And Build.scala:

```
val akkaVersion = "2.3.5"
val kamonVersion = "0.3.4"

// ...

val webadminLibs = Seq(
play.PlayImport.ws,
"jp.t2v" %% "play2-auth" % "0.12.0",
"org.imgscalr" % "imgscalr-lib" % "4.2",
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"io.kamon" %% "kamon-core" % kamonVersion,
"io.kamon" %% "kamon-datadog" % kamonVersion,
"io.kamon" %% "kamon-play" % kamonVersion,
"io.kamon" %% "kamon-log-reporter" % kamonVersion,
"io.kamon" %% "kamon-system-metrics" % kamonVersion,
"org.aspectj" % "aspectjweaver" % "1.8.2"
) map {
_ excludeAll(ExclusionRule("org.slf4j", "slf4j-log4j12"),
ExclusionRule("com.typesafe.play", "play_2.10")) }

// ...

val mmtsWebadmin = project.in(file("msn-webadmin"))
.enablePlugins(play.Play, play.PlayScala, SbtWeb)
.settings(debCustomSettings ++ sharedSettings: _*)
.settings(
name := "mmts-webadmin",
resolvers += "t2v.jp repo" at "http://www.t2v.jp/maven-repo/",
libraryDependencies ++= webadminLibs,
makeEtcDefault := None,
linuxPackageSymlinks := Seq.empty,
serverLoading in Debian := ServerLoader.SystemV
)
.settings(javaOptions <++= AspectjKeys.weaverOptions in Aspectj)
.settings(fork in run := true)
.settings(aspectjSettings :_*)
.dependsOn(mmtsCommons, mmtsBackend)
```

After deploying an application I can see using `ps` that

```
-javaagent:.../org.aspectj.aspectjweaver-1.8.2.jar
```

argument is passed to jvm. Also there are records in wrapper.log like
this: http://paste.ubuntu.com/9439722/ I'm not sure if this is a good
sign though.

I expect to see metrics like webadmin.gc.collection_time.max, but
there is no webadmin.* metrics at all. This metrics _are_ reported for
similar Play-free application.

What I'm doing wrong?

--
Best regards,
Eax Melanhovich
http://eax.me/

Иакс Меланхович

unread,
Dec 9, 2014, 5:36:06 AM12/9/14
to kamon...@googlegroups.com
Also according to tcpdump:

```
sudo tcpdump -i lo udp port 8125
```

Kamon doesn't report any metrics to datadog-statsd.

Ivan Topolnjak

unread,
Dec 9, 2014, 8:59:21 AM12/9/14
to kamon...@googlegroups.com
Hello there!

I see that you are also including the LogReporter extension, are you seeing the metrics being reported to the log? This is trying to discard whether it is a general problem or maybe specific to the kamon-datadog module. Also, please use Kamon 0.3.5 :), regards!

Иакс Меланхович

unread,
Dec 9, 2014, 10:03:06 AM12/9/14
to Ivan Topolnjak, kamon...@googlegroups.com
> Hello there!
>
> I see that you are also including the LogReporter extension, are you
> seeing the metrics being reported to the log?

No :(

> Also, please use Kamon 0.3.5 :), regards!

Ok, I switched to Kamon 0.3.5 but it didn't solve a problem.

Иакс Меланхович

unread,
Dec 10, 2014, 2:33:43 AM12/10/14
to kamon...@googlegroups.com
Play 2.3.7 - in case you are wondering.

Иакс Меланхович

unread,
Dec 10, 2014, 5:09:58 AM12/10/14
to kamon...@googlegroups.com
Ok, I managed to solve a problem! It appears that Kamon start to report
any metrics to Datadog only after somebody request at least one page
from Play. Any hints how this behaviour could be changed without
putting

```
curl localhost:8080
```

... in init.d script would be appreciated :). Just in case I will
ask this question in play-framework@ mailing list too.

On Wed, 10 Dec 2014 10:32:43 +0300

Иакс Меланхович

unread,
Dec 10, 2014, 5:24:16 AM12/10/14
to kamon...@googlegroups.com
> Just in case I will ask this question in play-framework@ mailing
> list too.

https://groups.google.com/forum/#!topic/play-framework/LS8lRkD_J5k

On Wed, 10 Dec 2014 13:08:56 +0300

Иакс Меланхович

unread,
Dec 10, 2014, 7:49:45 AM12/10/14
to kamon...@googlegroups.com
Solved :)

--------8<----------------8<--------

import play.libs._

object Global extends GlobalSettings {

override def onStart(app: Application) = {
// ActorSystem in Play is lazy. We need to force it computation,
// or Kamon will not report any metrics until somebody send first
// HTTP request.
val _ = Akka.system()

// ...
}

--------8<----------------8<--------

Diego Parra

unread,
Dec 11, 2014, 7:59:12 AM12/11/14
to kamon...@googlegroups.com
Иакс, thanks for sharing! and keep using Kamon :D, best regards!

--
You received this message because you are subscribed to the Google Groups "kamon-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kamon-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Topolnjak

unread,
Dec 14, 2014, 5:16:36 PM12/14/14
to kamon...@googlegroups.com
Иакс,

Thanks for sharing your solution! And sorry for getting back to this so late. Although you found a solution to the issue by forcing the startup of the Akka play extension, we should start automatically without you having to do that, I filled an issue to take care of initialisation [1], keep an eye on that to know when your solution wont be necessary anymore :)

Reply all
Reply to author
Forward
0 new messages