From ca71137eeec7a9aa2d7fc4884491dabab60012c8 Mon Sep 17 00:00:00 2001 From: Alexandra Konrad Date: Tue, 18 Jun 2024 18:37:48 +0200 Subject: [PATCH] fix existing tests --- crates/weaver_forge/src/extensions/otel.rs | 15 +++++++++++++++ crates/weaver_resolved_schema/src/attribute.rs | 2 +- crates/weaver_resolved_schema/src/lineage.rs | 10 ++-------- crates/weaver_resolver/src/attribute.rs | 3 +-- crates/weaver_semconv/src/attribute.rs | 1 + 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/crates/weaver_forge/src/extensions/otel.rs b/crates/weaver_forge/src/extensions/otel.rs index 0ca85d7d..45557d91 100644 --- a/crates/weaver_forge/src/extensions/otel.rs +++ b/crates/weaver_forge/src/extensions/otel.rs @@ -666,6 +666,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "rec.b".into(), @@ -680,6 +681,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "crec.a".into(), @@ -694,6 +696,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "crec.b".into(), @@ -708,6 +711,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "rec.c".into(), @@ -722,6 +726,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "rec.d".into(), @@ -736,6 +741,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "opt.a".into(), @@ -750,6 +756,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "opt.b".into(), @@ -764,6 +771,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "req.a".into(), @@ -778,6 +786,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "req.b".into(), @@ -792,6 +801,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, ]; let json = @@ -849,6 +859,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "attr2".to_owned(), @@ -863,6 +874,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, Attribute { name: "attr3".to_owned(), @@ -877,6 +889,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }, ]; @@ -1163,6 +1176,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }; add_tests_and_filters(&mut env); @@ -1189,6 +1203,7 @@ mod tests { deprecated: None, tags: None, value: None, + prefix: false, }; add_tests_and_filters(&mut env); diff --git a/crates/weaver_resolved_schema/src/attribute.rs b/crates/weaver_resolved_schema/src/attribute.rs index 7d9238d6..8326a9c1 100644 --- a/crates/weaver_resolved_schema/src/attribute.rs +++ b/crates/weaver_resolved_schema/src/attribute.rs @@ -9,9 +9,9 @@ use crate::value::Value; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::fmt::Display; +use std::ops::Not; use weaver_semconv::attribute::{AttributeSpec, AttributeType, Examples, RequirementLevel}; use weaver_semconv::stability::Stability; -use std::ops::Not; /// An attribute definition. #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema)] diff --git a/crates/weaver_resolved_schema/src/lineage.rs b/crates/weaver_resolved_schema/src/lineage.rs index bc128c01..d906b57b 100644 --- a/crates/weaver_resolved_schema/src/lineage.rs +++ b/crates/weaver_resolved_schema/src/lineage.rs @@ -406,15 +406,9 @@ impl AttributeLineage { /// from the parent. /// This method updates the lineage information for the tags field to /// reflect the source of its value. - pub fn prefix( - &mut self, - local_value: &bool, - parent_value: &bool, - ) -> bool { + pub fn prefix(&mut self, local_value: &bool, parent_value: &bool) -> bool { if *local_value { - _ = self - .locally_overridden_fields - .insert("prefix".to_owned()); + _ = self.locally_overridden_fields.insert("prefix".to_owned()); _ = self.inherited_fields.remove("prefix"); *local_value } else { diff --git a/crates/weaver_resolver/src/attribute.rs b/crates/weaver_resolver/src/attribute.rs index 020f77bf..bd617df5 100644 --- a/crates/weaver_resolver/src/attribute.rs +++ b/crates/weaver_resolver/src/attribute.rs @@ -90,7 +90,7 @@ impl AttributeCatalog { if *prefix { // depending on the prefix we either create embedded attribute or normal reference - name = format!("{}.{}", group_prefix, r#ref.clone()); + name = format!("{}.{}", group_prefix, r#ref); } else { name = r#ref.clone(); } @@ -142,7 +142,6 @@ impl AttributeCatalog { ); } - Some(attr_ref) } else { None diff --git a/crates/weaver_semconv/src/attribute.rs b/crates/weaver_semconv/src/attribute.rs index e3b03356..83dfe7c3 100644 --- a/crates/weaver_semconv/src/attribute.rs +++ b/crates/weaver_semconv/src/attribute.rs @@ -785,6 +785,7 @@ mod tests { note: Some("note".to_owned()), stability: Some(Stability::Stable), deprecated: Some("deprecated".to_owned()), + prefix: false, }; assert_eq!(attr.id(), "ref"); assert_eq!(attr.brief(), "brief");