From 1ec69bf0378f1f6a48bd89c77228f360156cfee7 Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Mon, 26 Aug 2024 15:33:22 +0200 Subject: [PATCH] Remove custom AttributeValue --- fpx-lib/src/api/models/otel.rs | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/fpx-lib/src/api/models/otel.rs b/fpx-lib/src/api/models/otel.rs index d9f9c6c67..fb9a428aa 100644 --- a/fpx-lib/src/api/models/otel.rs +++ b/fpx-lib/src/api/models/otel.rs @@ -231,7 +231,7 @@ impl From for SpanStatusCode { } #[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq)] -pub struct AttributeMap(BTreeMap>); +pub struct AttributeMap(BTreeMap>); impl From for AttributeMap { fn from(value: KeyValueList) -> Self { @@ -241,7 +241,7 @@ impl From for AttributeMap { impl From> for AttributeMap { fn from(attributes: Vec) -> Self { - let result: BTreeMap> = attributes + let result: BTreeMap> = attributes .into_iter() .map(|kv| { ( @@ -255,37 +255,37 @@ impl From> for AttributeMap { } } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -pub enum AttributeValue { - String(String), - Bool(bool), - Int(i64), - Double(f64), - Array(Vec), - KeyValueList(AttributeMap), - Bytes(Vec), -} - -impl From for AttributeValue { - fn from(value: any_value::Value) -> Self { - match value { - any_value::Value::StringValue(val) => AttributeValue::String(val), - any_value::Value::BoolValue(val) => AttributeValue::Bool(val), - any_value::Value::IntValue(val) => AttributeValue::Int(val), - any_value::Value::DoubleValue(val) => AttributeValue::Double(val), - any_value::Value::BytesValue(val) => AttributeValue::Bytes(val), - any_value::Value::ArrayValue(val) => { - let val: Vec<_> = val - .values - .into_iter() - .flat_map(|value| value.value.map(|value| value.into())) - .collect(); - AttributeValue::Array(val) - } - any_value::Value::KvlistValue(val) => AttributeValue::KeyValueList(val.values.into()), - } - } -} +// #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +// pub enum AttributeValue { +// String(String), +// Bool(bool), +// Int(i64), +// Double(f64), +// Array(Vec), +// KeyValueList(AttributeMap), +// Bytes(Vec), +// } + +// impl From for AttributeValue { +// fn from(value: any_value::Value) -> Self { +// match value { +// any_value::Value::StringValue(val) => AttributeValue::String(val), +// any_value::Value::BoolValue(val) => AttributeValue::Bool(val), +// any_value::Value::IntValue(val) => AttributeValue::Int(val), +// any_value::Value::DoubleValue(val) => AttributeValue::Double(val), +// any_value::Value::BytesValue(val) => AttributeValue::Bytes(val), +// any_value::Value::ArrayValue(val) => { +// let val: Vec<_> = val +// .values +// .into_iter() +// .flat_map(|value| value.value.map(|value| value.into())) +// .collect(); +// AttributeValue::Array(val) +// } +// any_value::Value::KvlistValue(val) => AttributeValue::KeyValueList(val.values.into()), +// } +// } +// } /// A trace contains a summary of its traces. #[derive(Clone, Debug, Deserialize, Serialize)]