-
Notifications
You must be signed in to change notification settings - Fork 25
/
prometheus.cabal
120 lines (107 loc) · 4.68 KB
/
prometheus.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: prometheus
version: 2.3.0
synopsis: Prometheus Haskell Client
homepage: http://github.com/bitnomial/prometheus
bug-reports: http://github.com/bitnomial/prometheus/issues
license: BSD3
license-file: LICENSE
author: Luke Hoersten
maintainer: [email protected], [email protected]
copyright: Bitnomial, Inc. (c) 2016-2023
category: Metrics, Monitoring, Web, System
build-type: Simple
cabal-version: >=1.10
description:
[Prometheus Haskell Client]
.
A simple and modern, type safe, performance focused, idiomatic Haskell client
for <http://prometheus.io Prometheus> monitoring. Specifically there is no
use of unsafe IO or manual ByteString construction from lists of
bytes. Batteries-included web server.
.
A key design element of this library is that the RegistryT monad transformer
is only required for registering new time series. Once the time series is
registered, new data samples may just be added in the IO monad.
.
Note: Version 0.* supports Prometheus v1.0 and version 2.* supports Prometheus v2.0.
.
[Usage Example]
.
> module Example where
>
> import Control.Monad.IO.Class (liftIO)
> import System.Metrics.Prometheus.Http.Scrape (serveMetricsT)
> 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
>
> serveMetricsT 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.
extra-source-files: Example.hs
, README.md
-- This flag builds the Example.hs file. It is only used for testing. It
-- is enabled in CI.
flag buildexamples
description: Build the Example.hs file. This is normally only used for testing.
default: False
library
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind
exposed-modules: System.Metrics.Prometheus.Concurrent.Registry
, System.Metrics.Prometheus.Concurrent.RegistryT
, System.Metrics.Prometheus.Encode.Text
, System.Metrics.Prometheus.Encode.Text.Histogram
, System.Metrics.Prometheus.Encode.Text.MetricId
, System.Metrics.Prometheus.Http.Push
, System.Metrics.Prometheus.Http.Scrape
, System.Metrics.Prometheus.Metric
, System.Metrics.Prometheus.Metric.Counter
, System.Metrics.Prometheus.Metric.Gauge
, System.Metrics.Prometheus.Metric.Histogram
, System.Metrics.Prometheus.Metric.Summary
, System.Metrics.Prometheus.MetricId
, System.Metrics.Prometheus.Registry
, System.Metrics.Prometheus.RegistryT
build-depends: base >= 4.9 && < 5
, atomic-primops >= 0.8 && < 0.9
, bytestring >= 0.10 && < 0.13
, containers >= 0.5 && < 0.8
, http-client >= 0.4 && < 0.8
, http-client-tls >= 0.3 && < 0.4
, http-types >= 0.8 && < 0.13
, network-uri >= 2.5 && < 2.7
, text >= 1.2 && < 2.2
, transformers >= 0.4 && < 0.7
, wai >= 3.2 && < 3.3
, warp >= 3.2 && < 3.5
executable prometheus-example
main-is: Example.hs
default-language: Haskell2010
ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind
build-depends: base
, prometheus
if flag(buildexamples)
buildable: True
else
buildable: False
source-repository head
type: git
location: https://github.com/bitnomial/prometheus