Cookie Notice

Play API

The Cinnamon Play API enables users to programmatically set the name of the metrics for client requests. Below is the example that illustrates this feature.

Client request naming

To name a request in a client use the Scala Request object or the Java Request class:

Scala
val future = Request.withName("AccountService") {
  ws.url(someURI).get()
}
Java
CompletionStage<WSResponse> response =
    Request.withName("AccountService", () -> ws.url(someURI).get());

If the client metrics configuration is set to monitor the request path someURI then its associated metrics will be named “AccountService”.