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. } }
- Alphabetic
- By Inheritance
- prometheus
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
CounterImplicits extends AnyRef
Enriches the Counter class with new functions.
Enriches the Counter class with new functions.
- Since
1.1
-
trait
GaugeImplicits extends AnyRef
Enriches the Gauge class with new functions.
Enriches the Gauge class with new functions.
- Since
1.0
-
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 noTimeUnitis in scope it defaults toTimeUnit.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
-
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
-
trait
SummaryImplicits extends AnyRef
Enriches the
Summaryclass with new functions.Enriches the
Summaryclass with new functions.The unit used to report latency/time measurements is decided by an implicitly available
TimeUnit.
If noTimeUnitis in scope it defaults toTimeUnit.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
-
object
Counters
Holds functions related to 'Counters'
Holds functions related to 'Counters'
- Since
1.1
-
object
Gauges
Holds functions related to 'Gauges'
-
object
Histograms
Holds functions related to 'Histograms'
-
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. }
-
object
Summaries
Holds functions related to 'Summaries'
-
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