Refactor series lookup
This commit is contained in:
@@ -59,7 +59,7 @@ impl FromUrl for AccountingIngestedBytesQuery {
|
||||
let ret = Self {
|
||||
backend: pairs
|
||||
.get("backend")
|
||||
.ok_or_else(|| Error::with_msg_no_trace("missing backend"))?
|
||||
.ok_or_else(|| Error::with_public_msg_no_trace("missing backend"))?
|
||||
.to_string(),
|
||||
range: SeriesRange::from_pairs(pairs)?,
|
||||
};
|
||||
@@ -121,14 +121,16 @@ impl FromUrl for AccountingToplistQuery {
|
||||
|
||||
fn from_pairs(pairs: &BTreeMap<String, String>) -> Result<Self, Error> {
|
||||
let fn1 = |pairs: &BTreeMap<String, String>| {
|
||||
let v = pairs.get("tsDate").ok_or(Error::with_public_msg("missing tsDate"))?;
|
||||
let v = pairs
|
||||
.get("tsDate")
|
||||
.ok_or(Error::with_public_msg_no_trace("missing tsDate"))?;
|
||||
let w = v.parse::<DateTime<Utc>>()?;
|
||||
Ok::<_, Error>(TsNano(w.to_nanos()))
|
||||
Ok::<_, Error>(TsNano::from_ns(w.to_nanos()))
|
||||
};
|
||||
let ret = Self {
|
||||
backend: pairs
|
||||
.get("backend")
|
||||
.ok_or_else(|| Error::with_msg_no_trace("missing backend"))?
|
||||
.ok_or_else(|| Error::with_public_msg_no_trace("missing backend"))?
|
||||
.to_string(),
|
||||
ts: fn1(pairs)?,
|
||||
limit: pairs.get("limit").map_or(None, |x| x.parse().ok()).unwrap_or(20),
|
||||
|
||||
@@ -170,11 +170,6 @@ impl PlainEventsQuery {
|
||||
self.do_test_stream_error = k;
|
||||
}
|
||||
|
||||
pub fn for_event_blobs(mut self) -> Self {
|
||||
self.transform = TransformQuery::for_event_blobs();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn for_time_weighted_scalar(mut self) -> Self {
|
||||
self.transform = TransformQuery::for_time_weighted_scalar();
|
||||
self
|
||||
@@ -196,6 +191,14 @@ impl PlainEventsQuery {
|
||||
pub fn create_errors_contains(&self, x: &str) -> bool {
|
||||
self.create_errors.contains(&String::from(x))
|
||||
}
|
||||
|
||||
pub fn summary_short(&self) -> String {
|
||||
format!(
|
||||
"PlainEventsQuery {{ chn: {}, range: {:?} }}",
|
||||
self.channel().name(),
|
||||
self.range()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasBackend for PlainEventsQuery {
|
||||
|
||||
Reference in New Issue
Block a user