@hackage prometheus0.2.0
Prometheus Haskell Client
Categories
License
BSD-3-Clause
Maintainer
luke@hoersten.org
Links
Versions
Installation
Dependencies (10)
- atomic-primops >=0.8 && <0.9
- base >=4.8 && <5
- bytestring >=0.10 && <0.11
- containers >=0.5 && <0.6
- http-types >=0.9 && <0.10
- mtl >=2.2 && <2.3 Show all…
Dependents (8)
@hackage/eventuo11y-prometheus, @hackage/prometheus-wai, @hackage/ridley-extras, @cardano/hydra-node, @hackage/ekg-prometheus-adapter, @hackage/ridley, Show all…
Prometheus Haskell Client
A simple and modern, type safe, idiomatic Haskell client for Prometheus monitoring. Specifically there is no use of unsafe IO or manual ByteString construction from lists of bytes. Batteries-included web server. . Usage Example
Usage Example
{-# LANGUAGE OverloadedStrings #-}
module Example where
import System.Metrics.Prometheus.GlobalRegistry
import System.Metrics.Prometheus.Http
import System.Metrics.Prometheus.Metric.Counter (inc)
import System.Metrics.Prometheus.MetricId
main :: IO ()
main = do
globalRegistry <- new
-- Labels can be defined as lists or added to an empty label set
connectSuccessGauge <- registerGauge "example_connections" (fromList [("login", "success")]) globalRegistry
connectFailureGauge <- registerGauge "example_connections" (addLabel "login" "failure" mempty) globalRegistry
connectCounter <- registerCounter "example_connection_total" mempty globalRegistry
latencyHistogram <- registerHistogram "example_round_trip_latency_ms" mempty [10, 20..100] globalRegistry
inc connectCounter -- increment a counter
-- [...] pass metric handles to the rest of the app
serveHttpTextMetrics 8080 globalRegistry -- http://localhost:8080/metric server
Advanced Usage
A Registry and StateT-based RegistryT are available for unit
testing or generating lists of [IO a] actions that can be
sequenced and returned from pure code to be applied.
Tasks
- Implement help docstrings.
- Implement GHC-specific metrics.
- Implement summary metric.
- Encode name and labels on register.
- Implement ReaderT for GlobalRegistry.
- Library documentation and example.
- Name and label validation