| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Fri, 16 Jan 2026 23:46:54 GMT
X-Served-By: cache-dfw-kdfw8210123-DFW, cache-bom-vanm7210033-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768607214.214619,VS0,VE299
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
data-prometheus: Prometheus metrics text format
data-prometheus: Prometheus metrics text format
Modules
[Index] [Quick Jump]
Flags
Automatic Flags
| Name | Description | Default |
|---|---|---|
| buildexecutable | Build example executable | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- data-prometheus-0.1.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0 |
|---|---|
| Dependencies | attoparsec, base (>=4.7 && <5), bytestring, containers, data-prometheus, lens, mtl, text, transformers, wreq [details] |
| License | BSD-3-Clause |
| Copyright | 2024 Sorki |
| Author | Sorki |
| Maintainer | srk@48.io |
| Uploaded | by srk at 2025-03-29T15:42:58Z |
| Category | Metrics |
| Home page | https://github.com/sorki/data-prometheus |
| Source repo | head: git clone https://github.com/sorki/data-prometheus |
| Distributions | LTSHaskell:0.1.0.0, NixOS:0.1.0.0, Stackage:0.1.0.0 |
| Executables | data-prometheus-exe |
| Downloads | 27 total (1 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2025-03-29 [all 1 reports] |
Readme for data-prometheus-0.1.0.0
[back to package description]data-prometheus
Pure Prometheus metrics parser and builder.
Usage
Parsing metrics
import qualified Data.Prometheus
import qualified Network.Wreq
import qualified Data.ByteString.Lazy
main :: IO ()
main = do
r <- Network.Wreq.get "https://localhost:9100/metrics"
case Data.Prometheus.parseProm
(Data.ByteString.Lazy.toStrict $ r ^. responseBody)
of
Right result -> print result
Left err -> putStrLn err
Generating metrics
In monadic manner
{-# LANGUAGE OverloadedStrings #-}
import Data.Prometheus
import qualified Data.Text.IO
main :: IO ()
main = do
Data.Text.IO.putStrLn
$ runMetrics (metric "readme")
$ do
addMetric
"subMetric"
(Counter 13)
logError "something is not right"
addMetric'
( sub "anotherSubMetric"
. sub "gauge"
. label "key" "val")
(Gauge 13)
or alternatively define ToMetrics instances for your data types.
Above example will output:
# HELP readme_gauge_anotherSubMetric
# TYPE readme_gauge_anotherSubMetric gauge
readme_gauge_anotherSubMetric{key="val"} 13.0
# HELP readme_subMetric
# TYPE readme_subMetric counter
readme_subMetric 13.0
# ERROR something is not right