Giter Site home page Giter Site logo

metrics-play's Introduction

metrics-play

This module provides some support for @codahale Metrics library in a Play2 application (Scala)

Build Status

Play Version: 2.3.0, Metrics Version: 3.0.1, Scala Versions: 2.10.2, 2.11.1

Features

  1. Default Metrics Registry
  2. Metrics Servlet
  3. Filter to instrument http requests

Usage

Add metrics-play dependency:

    val appDependencies = Seq(
    ...
    "com.kenshoo" %% "metrics-play" % "0.1.6"
    )

To enable the plugin:

add to conf/play.plugins the following line

 {priority}:com.kenshoo.play.metrics.MetricsPlugin

where priority is the priority of this plugin with respect to other plugins.

Default Registry

     import com.kenshoo.play.metrics.MetricsRegistry
     import com.codahale.metrics.Counter

     val counter = MetricsRegistry.default.counter("name")
     counter.inc()

Metrics Controller

An implementation of the metrics-servlet as a play2 controller.

It xports all registered metrics as a json document.

To enable the controller add a mapping to conf/routes file

 GET     /admin/metrics              com.kenshoo.play.metrics.MetricsController.metrics

Configuration

Some configuration is supported through the default configuration file:

metrics.rateUnit - (default is SECONDS) 

metrics.durationUnit (default is SECONDS)

metrics.showSamples [true/false] (default is false)

metrics.jvm - [true/false] (default is true)

Metrics Filter

An implementation of the Metrics' instrumenting filter for Play2. It records requests duration, number of active requests and counts each return code

    import com.kenshoo.play.metrics.MetricsFilter
    import play.api.mvc._

    object Global extends WithFilters(MetricsFilter)

License

This code is released under the Apache Public License 2.0.

metrics-play's People

Contributors

liorhar avatar howyp avatar dwhjames avatar

Watchers

James Cloos avatar Joseph Price avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.