Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package dmonix
    Definition Classes
    org
  • package prometheus

    Adds a Scala layer on the official [Prometheus Java client](https://github.com/prometheus/client_java) library.

    Adds a Scala layer on the official [Prometheus Java client](https://github.com/prometheus/client_java) library. The purpose is to elevate on the capabilities of the Scala language and provide more fitting constructs. E.g. lambdas from Java don't translate very well into Scala, so this library provides functional approaches to where the original library uses lambdas. Also for time/latency/gauge measurement purposes this library provides means to measure Futures.

    E.g. measuring the time spent in a function block.

    val requestLatency:Histogram = ...
    val result = requestLatency.measure{
      // Your code here.
    }

    Or measuring the time to execute a future provided as result by a function. The code snippet below will measure the time from invoking the function block to when the future is completed

    val requestLatency:Histogram = ...
    val f:Future[_] = requestLatency.measureAsync{
      Future {
        // Your code here.
      }
    }
    Definition Classes
    dmonix
  • CounterImplicits
  • Counters
  • GaugeImplicits
  • Gauges
  • HistogramImplicits
  • Histograms
  • Implicits
  • Summaries
  • SummaryImplicits
  • TimeUnitImplicits
p

org.dmonix

prometheus

package prometheus

Adds a Scala layer on the official [Prometheus Java client](https://github.com/prometheus/client_java) library. The purpose is to elevate on the capabilities of the Scala language and provide more fitting constructs. E.g. lambdas from Java don't translate very well into Scala, so this library provides functional approaches to where the original library uses lambdas. Also for time/latency/gauge measurement purposes this library provides means to measure Futures.

E.g. measuring the time spent in a function block.

val requestLatency:Histogram = ...
val result = requestLatency.measure{
  // Your code here.
}

Or measuring the time to execute a future provided as result by a function. The code snippet below will measure the time from invoking the function block to when the future is completed

val requestLatency:Histogram = ...
val f:Future[_] = requestLatency.measureAsync{
  Future {
    // Your code here.
  }
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. prometheus
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait CounterImplicits extends AnyRef

    Enriches the Counter class with new functions.

    Enriches the Counter class with new functions.

    Since

    1.1

  2. trait GaugeImplicits extends AnyRef

    Enriches the Gauge class with new functions.

    Enriches the Gauge class with new functions.

    Since

    1.0

  3. trait HistogramImplicits extends AnyRef

    Enriches the Histogram class with new functions.

    Enriches the Histogram class with new functions.

    The unit used to report latency/time measurements is decided by an implicitly available TimeUnit.
    If no TimeUnit is in scope it defaults to TimeUnit.SECONDS.
    One can either declare an implicit value:

    implicit val defaultUnit = TimeUnit.MILLISECONDS

    Or as in the this example import an implicit value:

    import org.dmonix.prometheus.TimeUnitImplicits.MILLISECONDS
    val requestLatency:Histogram = ...
    val result = requestLatency.measure {
      // Your code here.
      }
    Since

    1.0

  4. trait Implicits extends GaugeImplicits with HistogramImplicits with SummaryImplicits with CounterImplicits

    Combines all the individual metric traits ('*Implicits').

    Combines all the individual metric traits ('*Implicits').

    Example of usage:

    import org.dmonix.prometheus
    class FooBar extends Implicits
  5. trait SummaryImplicits extends AnyRef

    Enriches the Summary class with new functions.

    Enriches the Summary class with new functions.

    The unit used to report latency/time measurements is decided by an implicitly available TimeUnit.
    If no TimeUnit is in scope it defaults to TimeUnit.SECONDS.
    One can either declare an implicit value:

    implicit val defaultUnit = TimeUnit.MILLISECONDS

    Or as in the this example import an implicit value:

    import org.dmonix.prometheus.TimeUnitImplicits.MILLISECONDS
    val requestLatency:Summary = ...
    val result = requestLatency.measure {
      // Your code here.
      }

Value Members

  1. object Counters

    Holds functions related to 'Counters'

    Holds functions related to 'Counters'

    Since

    1.1

  2. object Gauges

    Holds functions related to 'Gauges'

  3. object Histograms

    Holds functions related to 'Histograms'

  4. object Implicits extends Implicits

    Object with all the metrics traits.

    Object with all the metrics traits.

    Used for importing the enriched traits as opposed to adding one of the traits to the class.

    import org.dmonix.prometheus.Implicits._
    val requestLatency:Histogram = ...
    val result = requestLatency.measure {
     // Your code here.
    }
  5. object Summaries

    Holds functions related to 'Summaries'

  6. object TimeUnitImplicits

    Implicit values one can import for usage with latency metric measurement.

    Implicit values one can import for usage with latency metric measurement.

    E.g.

    import org.dmonix.prometheus.TimeUnitImplicits.MILLISECONDS
    Since

    1.0

Inherited from AnyRef

Inherited from Any

Ungrouped