Expand description
Minimal API for getting time series data from prometheus, and making small plots.
To use it, instantiate one of the request objects, e.g. QueryRequest or QueryRangeRequest. When it’s helpful a builder is provided.
Then use PromRequest trait and call send or send_with_client.
This takes the prometheus url, and optionally a reqwest client to use.
On success, the result is PromData. One would usually call into_matrix()?
or into_vector()? as expected for the request that is made.
In prometheus, metric labels are just a set of key-value pairs. However,
if you are expecting certain structure, you may use any KV object that implements
serde::Deserialize in the PromData that results from the call.
When plot feature is active, the plot module can be used to plot the timeseries data.
This was designed to be used to generate previews in alert messages.
Modules§
- plot
- Make a simple plot of time-series data from prometheus
Structs§
- Alert
Info - Information about a single alert
- Alerts
Request - Query parameters for /api/v1/alerts prometheus request
- Alerts
Response - Response from /api/v1/alerts endpoint
- Extract
Labels - Common labels extracted from a very generic sequence of metric labels (key value pairs)
- Labels
Request - Query parameters for /api/v1/labels prometheus request
- Match
List - Represents a sequence of match[]=…,match[]=… query parameters required by parts of prometheus api
- Metric
Timeseries - A metric timeseries from a range query
- Metric
Val - Wrapper for f64 that deserializes from a string (prometheus returns numeric values as strings)
- Metric
Value - A single metric value from an instant query
- Query
Range Request - Query parameters for /api/v1/query_range prometheus request Use builder to populate it
- Query
Range Request Builder - Builder for constructing a QueryRangeRequest
- Query
Request - Query parameters for /api/v1/query prometheus request
- Reqwest
Client - An asynchronous
Clientto make Requests with. - Series
Request - Query parameters for /api/v1/series prometheus request
Enums§
- Alert
Status - The state of an alert
- Error
- Errors that can occur when making Prometheus API requests
- Prom
Data - The data payload from a Prometheus query response
Traits§
- Prom
Request - Trait for types that can be sent as Prometheus API requests
Type Aliases§
- Labels
- A set of labels extracted by ExtractLabels