data-prometheus-0.1.0.0: Prometheus metrics text format
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Prometheus.Monad

Synopsis

Documentation

class ToMetrics a where Source #

Methods

toMetrics :: Monad m => a -> MetricsT m Source #

Instances

Instances details
ToMetrics a => ToMetrics [a] Source # 
Instance details

Defined in Data.Prometheus.Monad

Methods

toMetrics :: forall (m :: Type -> Type). Monad m => [a] -> MetricsT m Source #

execMetricsT :: Monad m => MetricId -> MetricsT m -> m MetricState Source #

Evaluate metrics into MetricState

addMetric' Source #

Arguments

:: Monad m 
=> (MetricId -> MetricId)

Function to change the current MetricId

-> Metric

Metric to add

-> MetricsT m 

Add metric with value

addMetric Source #

Arguments

:: Monad m 
=> Text

Suffix (sub metric to add)

-> Metric

Metric to add

-> MetricsT m 

Add metric with value

subMetrics :: Monad m => Text -> MetricsT m -> MetricsT m Source #

Combinator to create sub-metrics

labeledMetrics Source #

Arguments

:: Monad m 
=> Text

Label name

-> Text

Label value

-> MetricsT m 
-> MetricsT m 

Combinator to create labeled metrics

metric :: Text -> MetricId Source #

Create metric with just name

sub :: Text -> MetricId -> MetricId Source #

Append subName to the name of a MetricId

metric "a" & sub "b"

results in name "a_b"

desc :: Text -> MetricId -> MetricId Source #

Set help text / description of a MetricId

label :: Text -> Text -> MetricId -> MetricId Source #

Add label to MetricId

mkGauge :: Double -> Metric Source #

Create Gauge metric

mkCounter :: Double -> Metric Source #

Create Counter metric

eitherExitCode :: Either a b -> Integer Source #

Right is exitcode 0, Left non-zero

eitherToGauge :: Either a b -> Metric Source #

Convert Either to Gauge, 0 meaning Right

boolToGauge :: Bool -> Metric Source #

Convert Bool to Gauge, 0 meaning False

enumToGauge :: Enum a => a -> Metric Source #

Convert Enum to Gauge, 0 (typically) meaning Ok status

floatToGauge :: Float -> Metric Source #

Convert Float to Gauge

logError :: Monad m => Text -> StateT MetricState m () Source #

Log error message

These are appended after all metrics were printed

Not a standard token but textfile collector ignores it as a comment and we can use it to provide some insight to our scripts.