Welcome!

Enterprise DevOps, Log Management and Analytics

Sematext Blog

Subscribe to Sematext Blog: eMailAlertsEmail Alerts
Get Sematext Blog via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Intel XML, XML Magazine

Blog Feed Post

Akka Monitoring with Kamon and SPM

SPM provides Akka monitoring via Kamon and has been doing that for quite a while now.  With SPM and Kamon you get out of the box metrics about Akka Actors, Dispatchers and Routers, about the JVMs your Akka app runs in, and system metrics.

We’ve recently made a few nice improvements that should be of interest to anyone using Akka, and especially those using Play! Framework.

Want to see a demo and don’t feel like reading?
Go to
https://apps.sematext.com/demo and look for any SPM apps with “Akka” in their name.

Want to see an example Akka app that uses Kamon SPM backend for monitoring?
See https://github.com/sematext/kamon-spm-example/

Transaction Traces, Trace Segments, and Errors

We’ve expanded our Transaction Tracing support and now support Kamon’s Traces and Trace Segments.  Note that Traces don’t necessarily have to be initiated by an HTTP request.  SPM’s Transaction Tracing lets you specify where a transaction starts.  You can see that in our Demo Akka App, which is not actually a web app, so we specified where in code its transactions start and end. Traces can be produced by instrumentation libraries like ‘kamon-play’ or manually in the code using something like this:

val tContext = Kamon.tracer.newContext("name")

And for segments:

val segment = tContext.startSegment("some-section", "business-logic", "kamon")
// your code that is a part of this transaction would be here
segment.finish()
tContext.finish()

So what exactly do these Akka monitoring reports look like?  Here are some examples:

image03https://sematext.com/wp-content/uploads/2016/10/image03-300x101.png 300w, https://sematext.com/wp-content/uploads/2016/10/image03-768x258.png 768w, https://sematext.com/wp-content/uploads/2016/10/image03-1024x344.png 1024w" sizes="(max-width: 1074px) 100vw, 1074px" />

Trace response time for AWS/ECS request trace

image05https://sematext.com/wp-content/uploads/2016/10/image05-300x102.png 300w" sizes="(max-width: 560px) 100vw, 560px" />

Slowest traces

image07https://sematext.com/wp-content/uploads/2016/10/image07-300x140.png 300w, https://sematext.com/wp-content/uploads/2016/10/image07-768x360.png 768w, https://sematext.com/wp-content/uploads/2016/10/image07-1024x479.png 1024w" sizes="(max-width: 1115px) 100vw, 1115px" />Trace and trace segment information

SPM will also show you charts with the number of transaction errors if you are using Kamon 0.6.3 or newer:

image12https://sematext.com/wp-content/uploads/2016/10/image12-300x74.png 300w, https://sematext.com/wp-content/uploads/2016/10/image12-768x190.png 768w, https://sematext.com/wp-content/uploads/2016/10/image12-1024x254.png 1024w" sizes="(max-width: 1356px) 100vw, 1356px" />

To enable this in your app just add the following to your application.conf (see example application.conf):

trace = [ "**" ]
trace-segment   = [ "**" ]

And add

"org.apache.thrift" % "libthrift" % "0.9.2"

to your dependencies in build.sbt.

If you are using Maven just add the following to your pom.xml:

<dependency>
  <groupId>org.apache.thrift</groupId>
  <artifactId>libthrift</artifactId>
  <version>0.9.2</version>
</dependency> 

Play! Framework Monitoring

Kamon includes a kamon-play module, which ships with bytecode instrumentation aimed at automatic traces and segments management and automatic trace token propagation to your Play! applications. SPM now has support for that, too, and now reports with traces, HTTP error counts, trace response times, and throughput.

 

image06https://sematext.com/wp-content/uploads/2016/10/image06-300x82.png 300w, https://sematext.com/wp-content/uploads/2016/10/image06-768x209.png 768w, https://sematext.com/wp-content/uploads/2016/10/image06-1024x279.png 1024w" sizes="(max-width: 1366px) 100vw, 1366px" />

image08https://sematext.com/wp-content/uploads/2016/10/image08-300x87.png 300w, https://sematext.com/wp-content/uploads/2016/10/image08-768x223.png 768w, https://sematext.com/wp-content/uploads/2016/10/image08-1024x297.png 1024w" sizes="(max-width: 1374px) 100vw, 1374px" />

image04https://sematext.com/wp-content/uploads/2016/10/image04-300x73.png 300w, https://sematext.com/wp-content/uploads/2016/10/image04-768x187.png 768w, https://sematext.com/wp-content/uploads/2016/10/image04-1024x249.png 1024w" sizes="(max-width: 1354px) 100vw, 1354px" />

To enable this in your Play! app just add the following to your application.conf (see example application.conf):

trace = [ "**" ]
trace-segment   = [ "**" ]
http-server     = [ "**" ]

Add “org.apache.thrift” % “libthrift” % “0.9.2” to dependencies

And follow instructions from: http://kamon.io/integrations/web-and-http-toolkits/play/ 

Better Memory Monitoring

For any apps that run on the JVM SPM will give you out of the box reports for various JVM metrics, like garbage collection counts and latency, size and utilization of every JVM memory pool, and JVM thread counts.  For Akka apps we go a bit further and provide additional reports for JVM heap and non-heap memory as well as class loading.  Here are some samples:

image01https://sematext.com/wp-content/uploads/2016/10/image01-1-300x85.png 300w, https://sematext.com/wp-content/uploads/2016/10/image01-1-768x218.png 768w, https://sematext.com/wp-content/uploads/2016/10/image01-1-1024x290.png 1024w" sizes="(max-width: 1376px) 100vw, 1376px" />

image10https://sematext.com/wp-content/uploads/2016/10/image10-300x84.png 300w, https://sematext.com/wp-content/uploads/2016/10/image10-768x214.png 768w, https://sematext.com/wp-content/uploads/2016/10/image10-1024x285.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" />

image11https://sematext.com/wp-content/uploads/2016/10/image11-300x84.png 300w, https://sematext.com/wp-content/uploads/2016/10/image11-768x215.png 768w, https://sematext.com/wp-content/uploads/2016/10/image11-1024x287.png 1024w" sizes="(max-width: 1354px) 100vw, 1354px" />

image02https://sematext.com/wp-content/uploads/2016/10/image02-1-300x84.png 300w, https://sematext.com/wp-content/uploads/2016/10/image02-1-768x216.png 768w, https://sematext.com/wp-content/uploads/2016/10/image02-1-1024x288.png 1024w" sizes="(max-width: 1374px) 100vw, 1374px" />

To get these reports you don’t have to do anything — you’ll get them out of the box.

Custom Metrics Monitoring

Besides giving you out the box monitoring with a number of integrations, you can also send custom metrics to SPM.  They can be performance metrics, business metrics, or really anything you want to graph, alert on, stick on dashboards, correlate with other metrics or logs (see Logsene!) and so on.  You can now send Custom Metrics via Kamon, too.

To start sending metrics to SPM, just add the following to kamon.spm.subscriptions {…} (see example application.conf):

histogram       = [ "**" ]
min-max-counter = [ "**" ]
gauge           = [ "**" ]
counter         = [ "**" ]

What do you get with that?  You get custom custom histograms on whichever metrics you send:

image00https://sematext.com/wp-content/uploads/2016/10/image00-300x87.png 300w, https://sematext.com/wp-content/uploads/2016/10/image00-768x224.png 768w, https://sematext.com/wp-content/uploads/2016/10/image00-1024x299.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" />

…. or custom counters:

image09https://sematext.com/wp-content/uploads/2016/10/image09-300x74.png 300w, https://sematext.com/wp-content/uploads/2016/10/image09-768x190.png 768w, https://sematext.com/wp-content/uploads/2016/10/image09-1024x253.png 1024w" sizes="(max-width: 1362px) 100vw, 1362px" />

We hope Sematext Akka monitoring helps you optimize run your Akka and Play apps better and faster!

Any question or feedback? Get in touch with us via Twitter or e-mail.

 

SIGN UP – FREE TRIAL

 

Read the original blog entry...

More Stories By Sematext Blog

Sematext is a globally distributed organization that builds innovative Cloud and On Premises solutions for performance monitoring, alerting and anomaly detection (SPM), log management and analytics (Logsene), and search analytics (SSA). We also provide Search and Big Data consulting services and offer 24/7 production support for Solr and Elasticsearch.