Giter Site home page Giter Site logo

metrics-scala's Introduction

Metrics-Scala

Capturing JVM- and application-level metrics. So you know what's going on.

This is the Scala API for Dropwizard's Metrics library.

Initially this project started out as a line for line copy of the Metrics-scala module, released for multiple scala versions. Metrics dropped the scala module in version 3.0.0 and this project continued separately with the help of @scullxbones.

We strive for long term stability, correctness, an easy to use API and full documentation (in that order).

Contents

Usage

Metrics-scala provides an easy way to create metrics and health checks in Scala. Since version 3.5.5 creating metrics and health checks is as easy as extending DefaultInstrumented and using the metrics and healthCheck builders:

class Example(db: Database) extends nl.grons.metrics.scala.DefaultInstrumented {
  // Define a health check
  healthCheck("alive") { workerThreadIsActive() }

  // Define a timer metric
  private[this] val loading = metrics.timer("loading")

  // Use timer metric
  def loadStuff(): Seq[Row] = loading.time {
    db.fetchRows()
  }
}

For more detailed information see the manual. For more information on Metrics-core 3.x, please see the documentation.

See also the change log for improvements and API changes.

Features

  • Easy creation of all metrics types.
  • Easy creation of Health Checks.
  • Almost invisible syntax for using timers (see example above).
  • Scala specific methods on metrics (e.g. += on counters).
  • Derives proper metrics names for Scala objects and closures.
  • Actor support.
  • Future support.
  • Hdrhistogram support.

Available versions (abbreviated)

This table shows the most relevant versions of metrics-scala. For the full list see all available versions.

Metrics-
scala
version
Metrics-
core
version
Akka
version
Scala version Hdr
version (*)
2.10 2.11 2.12
2.1.5 2.1.5
3.5.8 3.2.2 1.1.0/2.1.9
3.5.8_a2.3 3.2.2 2.3.16 / 2.4.x / 2.5.x 1.1.0/2.1.9
3.5.8_a2.4 3.2.2 2.4.18 / 2.5.x 1.1.0/2.1.9

If you need another version mix please open an issue, or sent an email to the metrics mailing list.

Akka 2.4 is binary compatible with Akka 2.3, and Akka 2.5 is binary compatible with Akka 2.4. Therefore you can freely use a metrics-scala build that was compiled against an older Akka version.

(*) Hdr is an optional dependency. The first number is the version of "org.mpierce.metrics.reservoir" % "hdrhistogram-metrics-reservoir", the second the version of "org.hdrhistogram" % "HdrHistogram". See also hdrhistogram manual page.

Download

SBT:

libraryDependencies += "nl.grons" %% "metrics-scala" % "3.5.8_a2.4"

Maven:

<properties>
    <scala.version>2.12.1</scala.version>
    <scala.compat.version>2.12</scala.compat.version>
</properties>
<dependency>
    <groupId>nl.grons</groupId>
    <artifactId>metrics-scala_${scala.compat.version}</artifactId>
    <version>3.5.8_a2.4</version>
</dependency>

To use hdrhistogram additional dependencies are needed. See the hdrhistogram manual page.

Support

If you find a bug, please open an issue, better yet: send a pull request. For questions, please sent an email to the metrics mailing list.

License

Copyright (c) 2010-2012 Coda Hale, Yammer.com (before 3.0.0)

Copyright (c) 2013-2017 Erik van Oosten (3.0.0 and later)

Published under Apache Software License 2.0, see LICENSE

metrics-scala's People

Contributors

codahale avatar erikvanoosten avatar ryantenney avatar chids avatar waywardmonkeys avatar scullxbones avatar cb372 avatar dinomite avatar jebl01 avatar collinvandyck avatar nicktelford avatar kevinclark avatar jmhodges avatar slakah avatar jasonberanek avatar javasoze avatar maciej avatar takezoe avatar neilprosser avatar stevenschlansker avatar konnik avatar oconnor0 avatar jklukas avatar jaimeagudo avatar gseitz avatar gshakhn avatar ccare avatar flicken avatar tmahesh avatar abramsm avatar

Watchers

ΘLΞG avatar James Cloos 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.