Browse Source

influx: better error logging

main
rozetko 2 years ago
parent
commit
f9e6c6df2c
  1. 10
      src/datasources/influx.rs

10
src/datasources/influx.rs

@ -46,8 +46,9 @@ pub fn parse_result(reader: Reader<impl Buf>) -> types::Result<MetricResult> {
let hdrs = rdr.headers(); let hdrs = rdr.headers();
if hdrs.is_err() { if hdrs.is_err() {
eprintln!("Influx query error: headers are empty");
return Err(anyhow::format_err!( return Err(anyhow::format_err!(
"Cant' extract metric: headers are empty" "[Influx] Can't extract metric, check server logs for more info"
)); ));
} }
@ -60,12 +61,9 @@ pub fn parse_result(reader: Reader<impl Buf>) -> types::Result<MetricResult> {
let measurement_name_position = 8usize; let measurement_name_position = 8usize;
if hdrs.get(measurement_name_position).is_none() { if hdrs.get(measurement_name_position).is_none() {
// println!("HEADERS:"); eprintln!("Influx query error: {:?}", hdrs);
// for h in hdrs {
// println!("{}", h);
// }
return Err(anyhow::format_err!( return Err(anyhow::format_err!(
"Cant' extract metric: no measurement at position {}", measurement_name_position "[Influx] Can't extract metric, check server logs for more info"
)); ));
} }
// println!("len: {:?}", rdr.headers().unwrap().get(9)); // println!("len: {:?}", rdr.headers().unwrap().get(9));

Loading…
Cancel
Save