Popularity
5.0
Declining
Activity
0.0
Stable
11
3
1

Monthly Downloads: 7
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Unclassified    
Latest version: v1.1.0

prometheus-effect alternatives and similar packages

Based on the "Unclassified" category.
Alternatively, view prometheus-effect alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of prometheus-effect or a related project?

Add another 'Unclassified' Package

README

Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company. To emphasize this and clarify the project's governance structure, Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project after Kubernetes.

This library provides a Haskell client to Prometheus. It supports:

  • The metric types counter, gauge and histogram.
  • Publishing metrics over HTTP (via WAI middleware).
  • Pushing metrics to the Prometheus push gateway.
  • Labels, along with dynamic labels.
  • Instrumentation, both for internal Prometheus monitoring and GHC statistics.

The library is intended to be easy to use, because instrumentation is already boring enough - the last thing you want is to be 5 pages deep in obscure GHC extensions just to bump a counter!

Here's one example to demonstrate how you could use this library:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

import Control.Concurrent
import Control.Monad
import Network.HTTP.Types.Status
import Prometheus
import System.Random
import qualified Network.Wai as Wai
import qualified Network.Wai.Handler.Warp as Warp

data Metrics = Metrics
  { iterations :: Counter
  , timePerLoop :: Histogram
  }

main :: IO ()
main = do
  (metrics, registry) <- buildRegistry $ do
    iterations <- register "iterations" "Total completed iterations" mempty counter
    timePerLoop <- register "time_per_loop" "Distribution of time per loop" mempty (histogram ioDurationBuckets)
    return Metrics{..}

  forkIO $ Warp.run 8000 $ publishRegistryMiddleware ["metrics"] registry $ \req mkRes ->
    mkRes (Wai.responseLBS notFound404 mempty mempty)

  forever $ time (timePerLoop metrics) $ do
    threadDelay =<< randomIO
    incCounter (iterations metrics)