add structured logging
This commit is contained in:
+10
-11
@@ -12,12 +12,10 @@ const DIM_PRESERVATION: &str = "Preservation (EUMOFAPreservation)";
|
||||
const DIM_SHIPSIZE: &str = "Shipsize";
|
||||
const DIM_MEASURE: &str = "measure";
|
||||
|
||||
const SENTINEL_VALUES: [f64; 1] = [-1.0];
|
||||
const SENTINEL_VALUE: f64 = -1.0;
|
||||
|
||||
fn is_sentinel(v: f64) -> bool {
|
||||
SENTINEL_VALUES
|
||||
.iter()
|
||||
.any(|s| v.total_cmp(s) == std::cmp::Ordering::Equal)
|
||||
v.total_cmp(&SENTINEL_VALUE) == std::cmp::Ordering::Equal
|
||||
}
|
||||
|
||||
pub async fn fetch_metadata(client: &Client, url: &str) -> Result<(LookupMap, MetadataResponse)> {
|
||||
@@ -83,13 +81,14 @@ pub fn chunk_months(months: &[String], batch_size: usize) -> Vec<Vec<String>> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn build_query(all_months: &[String]) -> Query {
|
||||
assert!(
|
||||
!all_months.is_empty(),
|
||||
"build_query requires at least one month"
|
||||
);
|
||||
pub fn build_query(all_months: &[String]) -> Result<Query> {
|
||||
if all_months.is_empty() {
|
||||
return Err(IngestError::InvalidValueCode(
|
||||
"build_query requires at least one month".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
Query {
|
||||
Ok(Query {
|
||||
query: vec![
|
||||
QueryItem {
|
||||
code: DIM_MONTH.to_string(),
|
||||
@@ -149,7 +148,7 @@ pub fn build_query(all_months: &[String]) -> Query {
|
||||
},
|
||||
],
|
||||
response: QueryResponse::default(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn fetch_data(client: &Client, url: &str, query: &Query) -> Result<DataResponse> {
|
||||
|
||||
Reference in New Issue
Block a user