Giter Site home page Giter Site logo

dealerdotcom / grails-yammer-metrics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeffellis/grails-yammer-metrics

0.0 10.0 0.0 259 KB

A plugin packaging the yammer metrics jars for use in Grails applications

License: Apache License 2.0

Groovy 100.00%

grails-yammer-metrics's Introduction

Grails Plugin for the Yammer Metrics Package

Provides the following features:

  • metrics-core
  • metrics-servlet

This plugin wires the AdminServlet to the /metrics endpoint in the including application. To disable this functionality, add the following to the application's Config: ''' metrics.servletEnabled = false ''' For detailed documentation on the yammer metrics package see:

http://metrics.codahale.com/index.html

Annotations

@Timed This annotation can be added to any method you wish to be timed. @Timed uses sensible defaults to create an instance of com.yammer.metrics.core.Timer and the associated code to update it from within your method body.

Before

class SomeService{
  public String serve(def foo, def bar) {
     return "OK";
  }
}

Timed the Java Way

class SomeService{
  private final Timer serveTimer = Metrics.newTimer(SomeService.class, "serveTimer", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
  public String serve(def foo, def bar) {
    final TimerContext context = responses.time();
    try {
        return "OK";
    } finally {
        context.stop();
    }
  }
}

Timed the Grails Way

class SomeService{
  @com.yammer.metrics.groovy.Timed
  public String serve(def foo, def bar) {
    return "OK"
  }
}

@Metered This annotation can be added to any method you wish to be metered. @Metered uses sensible defaults to create an instance of com.yammer.metrics.core.Meter and the associated code to update it from within your method body.

Before

class SomeService{
  public String serve(def foo, def bar) {
    return "OK";
  }
}

Metered the Java Way

class SomeService{
  private final Meter serveMeter = Metrics.newMeter(SomeService.class, "serveMeter", "serveMeter", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
  public String serve(def foo, def bar) {
    serveMeter.mark();
    return "OK";
  }
}

Metered the Grails Way

class SomeService{

  @com.yammer.metrics.groovy.Meter
  public String serve(def foo, def bar) {
    return "OK"
  }
}

Note: Annotations can be safely combined.

TODO

  • Support more of the underlying metric parameters via annotations
  • Annotations to support other yammer metrics
  • Automatic controller or service metrics
  • Some gui component (different plugin?)

License

This plugin is Copyright (c) 2012 Jeff Ellis

Published under Apache Software License 2.0, see LICENSE

The metrics jars are: Copyright (c) 2010-2012 Coda Hale, Yammer.com

Published under Apache Software License 2.0

grails-yammer-metrics's People

Contributors

jeffellis avatar

Watchers

Rob Friesel avatar Ryan Gardner avatar  avatar Ellery Crane avatar James Cloos avatar Brian Lloyd-Newberry avatar Adam Burnett avatar  avatar RL avatar Jose Schmidt 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.