package epimetheus
- Source
- package.scala
- Alphabetic
- By Inheritance
- epimetheus
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- final class Collector extends AnyRef
A Collector Represents a Metric or Group of Metrics that can be registered with a CollectorRegistry.
A Collector Represents a Metric or Group of Metrics that can be registered with a CollectorRegistry.
This is generally used for wrapping and bringing in Collectors as defined for Java Components
- final class CollectorRegistry[F[_]] extends AnyRef
A CollectorRegistry is a registry of Collectors.
A CollectorRegistry is a registry of Collectors.
It represents the concurrently shared state which holds the information of the metrics in question.
On Creation
Due to how prometheus scraping occurs, only one CollectorRegistry is generally useful per application. There are generally 2 approaches.
1. Create your own registry. Register Metrics with it. Expose that. Advantages: Full Control Of the Code 2. Use the global defaultRegistry Advantages: Easier Interop with Java libraries that may not give an option for interaction with arbitrary CollectorRegistries.
- sealed abstract class Counter[F[_]] extends AnyRef
Counter metric, to track counts, running totals, or events.
Counter metric, to track counts, running totals, or events.
If your use case can go up or down consider using a Gauge instead. Use the
rate()
function in Prometheus to calculate the rate of increase of a Counter. By convention, the names of Counters are suffixed by_total
.An Example Counter without Labels:
for { cr <- CollectorRegistry.build[IO] successCounter <- Counter.noLabels(cr, "example_success_total", "Example Counter of Success") failureCounter <- Counter.noLabels(Cr, "example_failure_total", "Example Counter of Failure") _ <- IO(println("Action Here")).guaranteeCase{ case ExitCase.Completed => successCounter.inc case _ => failureCounter.inc } } yield ()
An Example of a Counter with Labels:
for { cr <- CollectorRegistry.build[IO] counter <- Counter.labelled(cr, "example_total", "Example Counter", Sized("foo"), {s: String => Sized(s)}) _ <- counter.label("bar").inc _ <- counter.label("baz").inc } yield ()
- sealed abstract class Gauge[F[_]] extends AnyRef
Gauge metric, to report instantaneous values.
Gauge metric, to report instantaneous values.
Gauges can go both up and down.
An Example With No Labels:
for { cr <- CollectorRegistry.build gauge <- Gauge.noLabels(cr, "gauge_value", "Gauge Help") _ <- gauge.inc _ <- gauge.dec } yield ()
An Example With Labels:
for { cr <- CollectorRegistry.build gauge <- Gauge.labelled(cr, "gauge_value", "Gauge Help", Sized("foo"), {s: String => Sized(s)}) _ <- gauge.label("bar").inc _ <- gauge.label("bar").dec _ <- gauge.label("baz").inc _ <- gauge.label("baz").dec
These can be aggregated and processed together much more easily in the Prometheus server than individual metrics for each labelset.
- sealed abstract class Histogram[F[_]] extends AnyRef
Histogram metric, to track distributions of events.
Histogram metric, to track distributions of events.
Note: Each bucket is one timeseries. Many buckets and/or many dimensions with labels can produce large amount of time series, that may cause performance problems.
The default buckets are intended to cover a typical web/rpc request from milliseconds to seconds.
- final class Label extends AnyVal
- final class Name extends AnyVal
- sealed abstract class Summary[F[_]] extends AnyRef
Summary metric, to track the size of events.
Summary metric, to track the size of events.
The quantiles are calculated over a sliding window of time. There are two options to configure this time window:
maxAgeSeconds: Long - Set the duration of the time window is, i.e. how long observations are kept before they are discarded. Default is 10 minutes.
ageBuckets: Int - Set the number of buckets used to implement the sliding time window. If your time window is 10 minutes, and you have ageBuckets=5, buckets will be switched every 2 minutes. The value is a trade-off between resources (memory and cpu for maintaining the bucket) and how smooth the time window is moved. Default value is 5.
See https://prometheus.io/docs/practices/histograms/ for more info on quantiles.
- type UnlabelledCounter[F[_], A] = epimetheus.Counter.UnlabelledCounter[F, A]
- type UnlabelledGauge[F[_], A] = epimetheus.Gauge.UnlabelledGauge[F, A]
- type UnlabelledHistogram[F[_], A] = epimetheus.Histogram.UnlabelledHistogram[F, A]
- type UnlabelledSummary[F[_], A] = epimetheus.Summary.UnlabelledSummary[F, A]
Value Members
- object Collector
- object CollectorRegistry
- object Counter
Counter Constructors, and Unsafe Counter Access
- object Gauge
Gauge Constructors, and Unsafe Gauge Access
- object Histogram
Histogram Constructors, Convenience Methods and Unsafe Histogram Access
Histogram Constructors, Convenience Methods and Unsafe Histogram Access
Convenience function exposed here will also be exposed as implicit syntax enhancements on the Histogram
- object Label
- object Name
- object Summary
Summary Constructors, and Unsafe Summary Access