fixup cargo toml, update readme for prometheus http client

This commit is contained in:
Chris Beck
2025-12-18 15:32:35 -07:00
parent 4783d2d9c6
commit 95e996bc7c
3 changed files with 43 additions and 9 deletions
Generated
+15 -1
View File
@@ -1857,6 +1857,20 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-cli-jsonrpc-client"
version = "0.1.0"
dependencies = [
"futures-util",
"jsonrpsee",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "signal-gateway"
version = "0.1.0"
@@ -1869,7 +1883,6 @@ dependencies = [
"displaydoc",
"futures-util",
"humantime",
"jsonrpsee",
"metrics",
"prometheus-http-client",
"rand",
@@ -1877,6 +1890,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"signal-cli-jsonrpc-client",
"signal-gateway-assistant",
"thiserror",
"tokio",
-1
View File
@@ -56,7 +56,6 @@ rand = "0.9"
flate2 = "1"
regex = "1"
tar = "0.4"
prometheus-http-query = { version = "0.8", default-features = false }
reqwest = { version = "0.12", default-features = false, features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+28 -7
View File
@@ -1,13 +1,34 @@
# prometheus-http-client
Makes requests to the prometheus query API. With `plot` feature, also provides
a way to plot resposnes from prometheus.
a way to plot responses from prometheus.
*Note*: There are many prometheus query clients for rust -- I only made another because
I thought I only needed one or two routes so I would just use `reqwest` directly.
## Why a custom implementation?
Over time it has grown and now I feel a bit silly.
There are several prometheus query clients for Rust, but none quite fit the requirements:
This should probably be replaced
with [`prometheus-http-query`](https://docs.rs/prometheus-http-query/latest/prometheus_http_query/)
or one of the other competitors, except for the plotting functionality.
### [`prometheus-http-query`](https://docs.rs/prometheus-http-query)
The most complete and actively maintained option. However, it uses a structured
`Selector` builder that doesn't support raw PromQL selector strings. This means
queries like `__name__=~"http_.*"` or complex label matchers must be constructed
programmatically rather than passed as strings. For use cases where selectors
come from configuration files or user input, this is a significant limitation.
### [`prometheus-http-api`](https://docs.rs/prometheus-http-api)
Supports raw selector strings, which is great. However, it only implements
instant and range queries (`/api/v1/query` and `/api/v1/query_range`). It lacks
support for `/api/v1/series`, `/api/v1/labels`, `/api/v1/label/.../values`,
and `/api/v1/alerts` endpoints that this crate uses.
### [`proq`](https://docs.rs/proq) / [`prometheus-query`](https://docs.rs/prometheus-query)
Both are unmaintained (last updates 4+ years ago) and use outdated dependencies
like `tokio 0.1` and `hyper 0.12`.
### This crate
This implementation supports both raw PromQL selector strings and the full set of
API endpoints needed (query, query_range, series, labels, label values, alerts).
The `plot` feature adds time-series visualization using plotters.