themis
Types
A Store manages a collection of metrics, ensuring unique metric names.
pub type Store {
Store(
gauges: Dict(metric.MetricName, Metric(Gauge, Number, Nil)),
counters: Dict(
metric.MetricName,
Metric(Counter, Number, Nil),
),
histograms: Dict(
metric.MetricName,
Metric(Histogram, HistogramRecord, Set(Number)),
),
)
}
Constructors
-
Store( gauges: Dict(metric.MetricName, Metric(Gauge, Number, Nil)), counters: Dict(metric.MetricName, Metric(Counter, Number, Nil)), histograms: Dict( metric.MetricName, Metric(Histogram, HistogramRecord, Set(Number)), ), )
Represents possible errors that can occur when operating on the Store.
pub type StoreError {
MetricNameAlreadyInUse
MetricNameNotFound
MetricError(metric.MetricError)
LabelError(label.LabelError)
CounterError(counter.CounterError)
HistogramError(histogram.HistogramError)
}
Constructors
-
MetricNameAlreadyInUse
Returned when attempting to create a metric with a name that’s already in use
-
MetricNameNotFound
Returned when attempting to operate on a metric that doesn’t exist
-
MetricError(metric.MetricError)
Wraps errors related to metric name validation
-
LabelError(label.LabelError)
Wraps errors related to label validation
-
CounterError(counter.CounterError)
Wraps errors related to counters
-
HistogramError(histogram.HistogramError)
Wraps errors related to counters
Functions
pub fn is_metric_name_used(
store: Store,
name: MetricName,
) -> Bool
pub fn print(metrics_store store: Store) -> String
Formats all metrics in the store as a Prometheus-compatible text string.
Examples
let metrics_text = print(store)
// # HELP my_metric My first gauge
// # TYPE my_metric gauge
// my_metric{foo="bar"} 10
// my_metric{toto="tata",wibble="wobble"} +Inf