Skip to content
Snippets Groups Projects

Release: prepare and release v0.4.0

Merged Maaz Ahmed requested to merge 18-release-prepare-and-release-v0-4-0 into main
4 files
+ 40
19
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 3
11
@@ -23,7 +23,7 @@ impl IntoQryResult for Result<response::PromqlResult, error::Error> {
}
}
/// A wrapper for possible result types of expression queries ([`Client::query`](crate::Client::query) and [`Client::query_range`](crate::Client::query_range)).
/// A wrapper for possible result types of expression queries
#[derive(Clone, Debug, EnumAsInner)]
pub enum Data {
Vector(Vec<response::InstantVector>),
@@ -43,7 +43,7 @@ impl From<response::PromqlResult> for Data {
}
impl Data {
/// This is a shortcut to check if the query returned any data at all regardless of the exact type.
/// A shortcut to check if the query returned any data at all regardless of the exact type.
pub fn is_empty(&self) -> bool {
match self {
Data::Vector(v) => v.is_empty(),
@@ -66,10 +66,6 @@ pub enum Error {
/// Occurs when Prometheus responds with e.g. HTTP 4xx (e.g. due to a syntax error in a PromQL query).<br>
/// Details on the error as reported by Prometheus are included in [`PrometheusError`].
Prometheus(PrometheusError),
/// Occurs when the [`Client::series`](crate::Client::series) method is called with an empty set of
/// series [`Selector`](crate::selector::Selector)s. According to the Prometheus API description at least one
/// [`Selector`](crate::selector::Selector) must be provided.
EmptySeriesSelector,
}
impl Display for Error {
@@ -77,7 +73,6 @@ impl Display for Error {
match self {
Self::Client(e) => e.fmt(f),
Self::Prometheus(e) => e.fmt(f),
Self::EmptySeriesSelector => f.write_str("at least one series selector must be provided in order to query the series endpoint"),
}
}
}
@@ -87,7 +82,6 @@ impl std::error::Error for Error {
match self {
Self::Client(e) => e.source(),
Self::Prometheus(p) => p.source(),
Self::EmptySeriesSelector => None,
}
}
}
@@ -97,7 +91,6 @@ impl From<prometheus_http_query::Error> for Error {
match value {
prometheus_http_query::Error::Client(c) => Self::Client(c.into()),
prometheus_http_query::Error::Prometheus(p) => Self::Prometheus(p.into()),
prometheus_http_query::Error::EmptySeriesSelector => Self::EmptySeriesSelector,
_ => unreachable!(),
}
}
@@ -212,8 +205,7 @@ impl fmt::Display for PrometheusErrorType {
}
}
/// Is thrown when the [`Client`](crate::Client) or the underlying
/// [`reqwest::Error`] fail to build or execute a request.
/// Is thrown when the [`reqwest::Error`] fails to build or execute a request.
#[derive(Debug, Clone)]
pub struct ClientError(String);
Loading