tagged array creation rework
parent
b30e940df7
commit
6228b2393d
|
|
@ -21,8 +21,8 @@ impl JsonParser {
|
|||
return Value::Null;
|
||||
}
|
||||
|
||||
let mut vec_value: Vec<Value> = Vec::new();
|
||||
let mut array_key = String::new();
|
||||
// let mut vec_value: Vec<Value> = Vec::new();
|
||||
// let mut array_key = String::new();
|
||||
let mut value_json: Value = serde_json::from_str(json).unwrap_or(Value::Null);
|
||||
|
||||
let target_attr_vec = target.addr
|
||||
|
|
@ -97,16 +97,18 @@ impl JsonParser {
|
|||
.enumerate()
|
||||
.map(|(idx, val)| {
|
||||
let val = val.get(tag_name).unwrap_or(&Value::Null).clone();
|
||||
(serde_json::from_value::<serde_json::Map<String, Value>>(json!({tag_name: val})),
|
||||
(serde_json::from_value::<serde_json::Map<String, Value>>(
|
||||
json!({"tag_name": tag_name, "tag_value": val})
|
||||
),
|
||||
serde_json::from_value::<serde_json::Map<String, Value>>(metrics[idx].clone()))
|
||||
})
|
||||
.for_each(|(key, val)| {
|
||||
// dbg!(&key);
|
||||
if key.is_ok() && val.is_ok() {
|
||||
let mut key = key.unwrap();
|
||||
.for_each(|(tags, val)| {
|
||||
if val.is_ok() && tags.is_ok() {
|
||||
let mut tags = tags.unwrap();
|
||||
let mut val = val.unwrap();
|
||||
key.append(&mut val);
|
||||
values.push(json!(key));
|
||||
tags.append(&mut val);
|
||||
dbg!(&tags);
|
||||
values.push(json!(tags));
|
||||
}
|
||||
});
|
||||
if values.len() == 0 {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use dotenv::dotenv;
|
|||
use crate::json::JsonParser;
|
||||
use crate::export::Exporter;
|
||||
use integr_structs::api::v3::{Config, ConfigEndpoint, Credentials, Metrics, PrometheusMetrics};
|
||||
use md5::compute;
|
||||
// use md5::compute;
|
||||
|
||||
// type BufferType = Arc<Mutex<Vec<String>>>;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue