Module

System.Metrics

Package
purescript-metrics
Repository
abhin4v/purescript-metrics

#Store Source

newtype Store

A mutable metric store.

#MetricSampler Source

data MetricSampler

Different types of metric samplers.

Constructors

#Value Source

data Value

Value of different metric samplers. Counter and Gauge values are their Int values. Histogram, Meter, and Timer values are the summary records of their values.

Constructors

Instances

#newStore Source

newStore :: forall eff. Eff (ref :: REF | eff) Store

Creates a new, empty metric store.

#register Source

register :: forall eff. String -> MetricSampler -> Store -> Eff (ref :: REF | eff) Boolean

Registers a metric sampler with the given name, to the given metric store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#registerOrGet Source

registerOrGet :: forall eff. String -> MetricSampler -> Store -> Eff (ref :: REF | eff) MetricSampler

Registers and returns a metric sampler with the given name, to the given metric store if another one is not registered with the given name. Else, returns the metric sampler registered with the given name.

#get Source

get :: forall eff. String -> Store -> Eff (ref :: REF | eff) (Maybe MetricSampler)

Returns a metric sampler registered to the given metric store with the given name.

#registerCounter Source

registerCounter :: forall eff. String -> Counter -> Store -> Eff (ref :: REF | eff) Boolean

Register a Counter with the given name to the given store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#registerGauge Source

registerGauge :: forall eff. String -> Gauge -> Store -> Eff (ref :: REF | eff) Boolean

Register a Gauge with the given name to the given store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#registerHistogram Source

registerHistogram :: forall eff. String -> Histogram -> Store -> Eff (ref :: REF | eff) Boolean

Register a Histogram with the given name to the given store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#registerMeter Source

registerMeter :: forall eff. String -> Meter -> Store -> Eff (ref :: REF | eff) Boolean

Register a Meter with the given name to the given store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#registerTimer Source

registerTimer :: forall eff. String -> Timer -> Store -> Eff (ref :: REF | eff) Boolean

Register a Timer with the given name to the given store. Returns true if registration succeeds, false if registration fails because another metric sampler is already registered with the given name.

#createOrGetCounter Source

createOrGetCounter :: forall eff. String -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Counter

Creates, registers and returns a Counter with the given name to the given store. If a Counter is already registered with the given name, returns it. Throws exception if a non-Counter metric sampler is already registered with the given name.

#createOrGetGauge Source

createOrGetGauge :: forall eff. String -> (forall e. Aff e Int) -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Gauge

Creates, registers and returns a Gauge with the given name to the given store. If a Gauge is already registered with the given name, returns it. Throws exception if a non-Gauge metric sampler is already registered with the given name.

#createOrGetHistogramWithExponentialDecaySampling Source

createOrGetHistogramWithExponentialDecaySampling :: forall eff. String -> Int -> Number -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Histogram

Creates, registers and returns a Histogram with exponential decay sampling, with the given name to the given store. If a Histogram is already registered with the given name, returns it. Throws exception if a non-Histogram metric sampler is already registered with the given name.

#createOrGetHistogramWithUniformSampling Source

createOrGetHistogramWithUniformSampling :: forall eff. String -> Int -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Histogram

Creates, registers and returns a Histogram with uniform sampling, with the given name to the given store. If a Histogram is already registered with the given name, returns it. Throws exception if a non-Histogram metric sampler is already registered with the given name.

#createOrGetMeter Source

createOrGetMeter :: forall eff. String -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Meter

Creates, registers and returns a Meter with the given name to the given store. If a Meter is already registered with the given name, returns it. Throws exception if a non-Meter metric sampler is already registered with the given name.

#createOrGetTimer Source

createOrGetTimer :: forall eff. String -> Store -> Eff (exception :: EXCEPTION, ref :: REF | eff) Timer

Creates, registers and returns a Timer with the given name to the given store. If a Timer is already registered with the given name, returns it. Throws exception if a non-Timer metric sampler is already registered with the given name.

#sampleOne Source

sampleOne :: forall eff. MetricSampler -> Aff (ref :: REF | eff) Value

Samples the value of a metric sampler.

#sample Source

sample :: forall eff. Store -> Aff (ref :: REF | eff) Sample

Samples the value of all metric samplers in the given store.