Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

v2.0.1 - Upgrade to Kamon 2.0

Latest
Compare
Choose a tag to compare
@ivantopo ivantopo released this 19 Nov 23:33
· 3 commits to master since this release

First Release for Kamon 2.0

This is the first release coming up for Kamon 2.0! The annotation names changed a bit from the pre-2.0 series so please read the description bellow to see what is shipping with this version.

Initial Setup

It is necessary to tell Kamon where to search for annotated classes using the kanela.modules.annotation.within configuration setting. For example, if you want to process annotations on all classes withing the my.company package, the following settings should be added to your application.conf file:

kanela.modules.annotation {
  within += "my.company.*"
}

Manipulating Traces

Creating Spans is one of the most basic tasks you would want to perform to start monitoring your application using Kamon and the @Trace annotation allow you to do just that:

  • @Trace: Creates a new Span every time the method is called and automatically finished once the method returns. If the annotated method returns a Scala Future or a CompletionStage, the Span will be finished when the Future/CompletionStage finishes.

  • @CustomizeInnerSpan: Tells Kamon to use the provided customizations when any Span is created within the Scope of the annotated method. This is specially useful when you want to customize the operation name of Spans that are automatically created by Kamon (e.g. customizing JDBC operation names)

Manipulating Metrics

Additionally to manipulating Spans, this module can automatically track metrics as the annotated methods execute. The available annotations are:

  • @Count: Creates a Counter that tracks invocations of the annotated method.

  • @Time: Creates a Timer that tracks the latency of each invocation of the annotated method. If the annotated method returns a Scala Future or a CompletionStage, the Timer will be stopped when the Future/CompletionStage finishes.

  • @Histogram: Creates a Histogram that tracks the values returned by the annotated method. Obviously, only methods returning numeric values are accepted.

  • @Gauge: Creates a Gauge that tracks the last returned value by the annotated method.

  • @TrackConcurrency: Creates a Range Sampler that is incremented when the annotated method starts executing and decremented when it finishes. If the annotated method returns a Scala Future or a CompletionStage, the Timer will be stopped when the Future/CompletionStage finishes.

EL Expression Support

The name and tags properties are evaluated as [EL] expressions for all annotations that manipulate instruments.