refactor
test-org/integration-module/pipeline/pr-rc This commit looks good
Details
test-org/integration-module/pipeline/pr-rc This commit looks good
Details
parent
774a517def
commit
adb1ba4c07
|
|
@ -1,11 +1,10 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt::Display;
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use integr_structs::api::enode_monitoring::{AuthResponse, ForTokenCredentials, GenericUrl, get_chunk_size};
|
use integr_structs::api::enode_monitoring::{AuthResponse, ForTokenCredentials, get_chunk_size};
|
||||||
use integr_structs::api::enode_monitoring::cmdb::Query;
|
use integr_structs::api::enode_monitoring::cmdb::Query;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|
@ -14,8 +13,6 @@ use integr_structs::api::v3::{MetricOutputExtended, PrometheusMetricsExtended};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
// const IM_CONNECTION_TIMEOUT: String = std::env::var("IM_CONNECTION_TIMEOUT").unwrap_or_else(|_| "10".to_string());
|
|
||||||
|
|
||||||
trait AsDeviceRequest {
|
trait AsDeviceRequest {
|
||||||
fn as_devices(self) -> Vec<String>;
|
fn as_devices(self) -> Vec<String>;
|
||||||
}
|
}
|
||||||
|
|
@ -55,23 +52,6 @@ impl IntoEnodeRequset for &[MetricInstance] {
|
||||||
vec.concat()
|
vec.concat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// impl<T> GenericUrl for [(T, T)]
|
|
||||||
// where T : Display {
|
|
||||||
// fn display(&self) -> String {
|
|
||||||
// let mut vec: Vec<String> = Vec::new();
|
|
||||||
// vec.push("%5B".to_owned());
|
|
||||||
// self.iter()
|
|
||||||
// .enumerate()
|
|
||||||
// .for_each(|(id, val)| {
|
|
||||||
// if id > 0 {
|
|
||||||
// vec.push(",".to_owned());
|
|
||||||
// }
|
|
||||||
// vec.push(format!("%22{}%22", val.0));
|
|
||||||
// });
|
|
||||||
// vec.push("%5D".to_owned());
|
|
||||||
// vec.concat()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct MetricMeta {
|
struct MetricMeta {
|
||||||
|
|
@ -92,6 +72,7 @@ impl Default for MetricMeta {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(private_interfaces)]
|
||||||
pub trait LazyUnzipInstance {
|
pub trait LazyUnzipInstance {
|
||||||
fn lazy_unzip(&self) -> HashMap<String, MetricMeta>;
|
fn lazy_unzip(&self) -> HashMap<String, MetricMeta>;
|
||||||
}
|
}
|
||||||
|
|
@ -518,7 +499,7 @@ impl MonitoringImporter {
|
||||||
if id.is_empty() {
|
if id.is_empty() {
|
||||||
return Err(Error::msg("Empty `id` field. Invalid JSON response"))
|
return Err(Error::msg("Empty `id` field. Invalid JSON response"))
|
||||||
}
|
}
|
||||||
let temp = MetricOutputExtended::new_with_slices(
|
Ok(MetricOutputExtended::new_with_slices(
|
||||||
id.as_ref(),
|
id.as_ref(),
|
||||||
&meta.name,
|
&meta.name,
|
||||||
{
|
{
|
||||||
|
|
@ -540,32 +521,7 @@ impl MonitoringImporter {
|
||||||
Some(device),
|
Some(device),
|
||||||
Some(meta.source.clone()),
|
Some(meta.source.clone()),
|
||||||
val.clone(),
|
val.clone(),
|
||||||
);
|
))
|
||||||
dbg!(temp);
|
|
||||||
todo!();
|
|
||||||
Ok(temp)
|
|
||||||
// Ok(MetricOutputExtended {
|
|
||||||
// id : id.to_owned(),
|
|
||||||
// name : &meta.name,
|
|
||||||
// json_type : match val {
|
|
||||||
// Value::Number(val) => {
|
|
||||||
// if val.is_i64() {
|
|
||||||
// "i64".to_owned()
|
|
||||||
// } else if val.is_u64() {
|
|
||||||
// "u64".to_owned()
|
|
||||||
// } else {
|
|
||||||
// "f64".to_owned()
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// _ => "unknown".to_owned(),
|
|
||||||
// },
|
|
||||||
// addr : "enode.monitoring.api".to_owned(),
|
|
||||||
// desc : meta.desc.clone(),
|
|
||||||
// value : val.clone(),
|
|
||||||
// device: Some(device),
|
|
||||||
// source: Some(meta.source.clone()),
|
|
||||||
// status: 0,
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue