prometheus: Prometheus Haskell Client

[ bsd3, library, metrics, monitoring, system, web ] [ Propose Tags ]
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
module Example where

import           Control.Monad.IO.Class                         (liftIO)
import           System.Metrics.Prometheus.Concurrent.Http      (serveHttpTextMetricsT)
import           System.Metrics.Prometheus.Concurrent.RegistryT
import           System.Metrics.Prometheus.Metric.Counter       (inc)
import           System.Metrics.Prometheus.MetricId

main :: IO ()
main = runRegistryT $ do
    -- Labels can be defined as lists or added to an empty label set
    connectSuccessGauge <- registerGauge "example_connections" (fromList [("login", "success")])
    connectFailureGauge <- registerGauge "example_connections" (addLabel "login" "failure" mempty)
    connectCounter <- registerCounter "example_connection_total" mempty
    latencyHistogram <- registerHistogram "example_round_trip_latency_ms" mempty [10, 20..100]

    liftIO $ inc connectCounter -- increment a counter

    -- [...] pass metric handles to the rest of the app

    serveHttpTextMetricsT 8080 ["metrics"] -- 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.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.1, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.2.1, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.2.1, 2.2.2, 2.2.3, 2.2.4
Dependencies atomic-primops (>=0.8 && <0.9), base (>=4.7 && <4.11), bytestring (>=0.10 && <0.11), containers (>=0.5 && <0.6), http-client (>=0.5 && <0.6), http-types (>=0.8 && <0.10), lens (>=4.15 && <4.16), proto-lens (>=0.2 && <0.3), proto-lens-protoc (>=0.2 && <0.3), text (>=1.2 && <1.3), transformers (>=0.4 && <0.6), wai (>=3.2 && <3.3), warp (>=3.2 && <3.3), wreq (>=0.5 && <0.6) [details]
License BSD-3-Clause
Copyright Bitnomial, Inc. (c) 2016
Author Luke Hoersten
Maintainer luke@bitnomial.com, opensource@bitnomial.com
Category Metrics, Monitoring, Web, System
Home page http://github.com/bitnomial/prometheus
Bug tracker http://github.com/bitnomial/prometheus/issues
Source repo head: git clone https://github.com/bitnomial/prometheus
Uploaded by LukeHoersten at 2017-11-27T23:08:38Z
Distributions LTSHaskell:2.2.4, NixOS:2.2.4, Stackage:2.2.4
Reverse Dependencies 5 direct, 1 indirect [details]
Downloads 22493 total (207 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-28 [all 1 reports]

Readme for prometheus-0.5.0

[back to package description]

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           Control.Monad.IO.Class                         (liftIO)
import           System.Metrics.Prometheus.Concurrent.Http      (serveHttpTextMetricsT)
import           System.Metrics.Prometheus.Concurrent.RegistryT
import           System.Metrics.Prometheus.Metric.Counter       (inc)
import           System.Metrics.Prometheus.MetricId

main :: IO ()
main = runRegistryT $ do
    -- Labels can be defined as lists or added to an empty label set
    connectSuccessGauge <- registerGauge "example_connections" (fromList [("login", "success")])
    connectFailureGauge <- registerGauge "example_connections" (addLabel "login" "failure" mempty)
    connectCounter <- registerCounter "example_connection_total" mempty
    latencyHistogram <- registerHistogram "example_round_trip_latency_ms" mempty [10, 20..100]

    liftIO $ inc connectCounter -- increment a counter

    -- [...] pass metric handles to the rest of the app

    serveHttpTextMetricsT 8080 ["metrics"] -- 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 Concurrent Registry.
  • Library documentation and example.
  • Name and label validation