Skip to content

Commit 78ad1a0

Browse files
author
Liudmila Molkova
authored
Deprecate deprecated stability level (#607)
* Remove deprecated stability level * change the earliest compatible version to 1.25.0 * deprecate deprecated stability, but keep it around * fix build * changelog * fix merge issues
1 parent 4b38aea commit 78ad1a0

File tree

6 files changed

+124
-29
lines changed

6 files changed

+124
-29
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ All notable changes to this project will be documented in this file.
77
What's changed
88

99
* Add support for annotations on attributes and groups. ([#645](https://github.com/open-telemetry/weaver/pull/645) by @lquerel).
10-
* 💥 BREAKING CHANGE 💥 - Upgrade to version 0.4.0 of regorus [requires all v0 policies to be modified](https://github.com/microsoft/regorus/pull/373). Policy upgrade instructions [here](https://www.openpolicyagent.org/docs/latest/v0-upgrade/#upgrading-rego) may help. ([#651](https://github.com/open-telemetry/weaver/pull/651) by @jerbly).
10+
* 💥 BREAKING CHANGE 💥 - Upgrade to version 0.4.0 of regorus [requires all v0 policies to be modified](https://github.com/microsoft/regorus/pull/373). Policy upgrade instructions [here](https://www.openpolicyagent.org/docs/latest/v0-upgrade/#upgrading-rego) may help. ([#651](https://github.com/open-telemetry/weaver/pull/651) by @jerbly).
11+
* Stability level `Deprecated` is deprecated. Conventions should be deprecated via `deprecated` field and should keep the original stability. ([#607](https://github.com/open-telemetry/weaver/pull/607) by @lmolkova).
1112

1213
## [0.13.2] - 2025-02-13
1314

@@ -39,11 +40,11 @@ What's changed
3940

4041

4142

42-
* Improvement of comment generation: removal of `<p>` tags that precede `@` Javadoc tags.
43+
* Improvement of comment generation: removal of `<p>` tags that precede `@` Javadoc tags.
4344
([#574](https://github.com/open-telemetry/weaver/pull/574) by @trask).
4445
* For Issue [#564](https://github.com/open-telemetry/weaver/issues/564) - Require attributes and event fields to have stability: Added warnings for missing stability
4546
on: Attributes, Enum members in attributes, Event AnyValues, Enum members in AnyValues. ([#568](https://github.com/open-telemetry/weaver/pull/568) by @jerbly).
46-
* For issue [#569](Add include_stability config into semconv_grouped_attributes): `is_experimental` returns `true` by default. ([#570](https://github.com/open-telemetry/weaver/pull/570) by @jerbly).
47+
* For issue [#569](Add include_stability config into semconv_grouped_attributes): `is_experimental` returns `true` by default. ([#570](https://github.com/open-telemetry/weaver/pull/570) by @jerbly).
4748
* Added an OTLP receiver to Weaver to prepare for the `weaver registry live-check` command. (see [#548](https://github.com/open-telemetry/weaver/pull/548) by @lquerel)
4849
* Add is_array filter and test for AttributeType. ([#540](https://github.com/open-telemetry/weaver/pull/540) by @arthurDiff).
4950
* Refactored CLI registry commands to remove some duplication. Resolving the registry with policy checks is common for
@@ -61,7 +62,7 @@ What's changed
6162
`semconv_signal`, `semconv_grouped_attributes`, and other `semconv_*` JQ semconv helpers. When `stable_only` is set to `true`,
6263
corresponding helper function returns stable conventions only. If the flag is not set or set to false, stability filtering does not apply.
6364
It's recommended to use `stable_only` flag instead of `exclude_stability` parameter.
64-
([#588](https://github.com/open-telemetry/weaver/pull/588) by @lmolkova)
65+
([#588](https://github.com/open-telemetry/weaver/pull/588) by @lmolkova)
6566

6667
## [0.12.0] - 2024-12-09
6768

crates/weaver_forge/src/extensions/otel.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,15 +738,6 @@ mod tests {
738738
});
739739
assert!(is_experimental(&attr));
740740

741-
// An attribute with stability "deprecated"
742-
let attr = Value::from_object(DynAttr {
743-
id: "test".to_owned(),
744-
r#type: "test".to_owned(),
745-
stability: "deprecated".to_owned(),
746-
deprecated: None,
747-
});
748-
assert!(is_experimental(&attr));
749-
750741
// An attribute with stability "stable"
751742
let attr = Value::from_object(DynAttr {
752743
id: "test".to_owned(),

crates/weaver_semconv/src/group.rs

Lines changed: 117 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ impl GroupSpec {
122122
});
123123
}
124124

125+
// `deprecated` stability is deprecated
126+
if self.stability == Some(Stability::Deprecated) {
127+
errors.push(Error::InvalidGroupStability {
128+
path_or_url: path_or_url.to_owned(),
129+
group_id: self.id.clone(),
130+
error: "Group stability is set to 'deprecated' which is no longer supported."
131+
.to_owned(),
132+
});
133+
}
134+
125135
// Groups should only reference attributes once.
126136
validate_duplicate_attribute_ref(&mut errors, &self.attributes, &self.id, path_or_url);
127137

@@ -264,6 +274,13 @@ impl GroupSpec {
264274
attribute_id: attribute.id(),
265275
error: "Missing stability field.".to_owned(),
266276
});
277+
} else if stability.clone() == Some(Stability::Deprecated) {
278+
errors.push(Error::InvalidAttributeWarning {
279+
path_or_url: path_or_url.to_owned(),
280+
group_id: self.id.clone(),
281+
attribute_id: attribute.id(),
282+
error: "Attribute stability is set to 'deprecated' which is no longer supported.".to_owned(),
283+
});
267284
}
268285

269286
if let AttributeType::Enum { members, .. } = r#type {
@@ -278,6 +295,16 @@ impl GroupSpec {
278295
member.id
279296
),
280297
});
298+
} else if member.stability == Some(Stability::Deprecated) {
299+
errors.push(Error::InvalidAttributeWarning {
300+
path_or_url: path_or_url.to_owned(),
301+
group_id: self.id.clone(),
302+
attribute_id: attribute.id(),
303+
error: format!(
304+
"Member {} stability is set to 'deprecated' which is no longer supported.",
305+
member.id
306+
),
307+
});
281308
}
282309
}
283310
}
@@ -578,15 +605,15 @@ mod tests {
578605
note: "test".to_owned(),
579606
prefix: "".to_owned(),
580607
extends: None,
581-
stability: Some(Stability::Deprecated),
608+
stability: Some(Stability::Development),
582609
deprecated: Some(Deprecated::Obsoleted {
583610
note: "".to_owned(),
584611
}),
585612
attributes: vec![AttributeSpec::Id {
586613
id: "test".to_owned(),
587614
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
588615
brief: None,
589-
stability: Some(Stability::Deprecated),
616+
stability: Some(Stability::Development),
590617
deprecated: Some(Deprecated::Obsoleted {
591618
note: "".to_owned(),
592619
}),
@@ -713,15 +740,15 @@ mod tests {
713740
note: "test".to_owned(),
714741
prefix: "".to_owned(),
715742
extends: None,
716-
stability: Some(Stability::Deprecated),
743+
stability: Some(Stability::Development),
717744
deprecated: Some(Deprecated::Obsoleted {
718745
note: "".to_owned(),
719746
}),
720747
attributes: vec![AttributeSpec::Id {
721748
id: "test".to_owned(),
722749
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
723750
brief: None,
724-
stability: Some(Stability::Deprecated),
751+
stability: Some(Stability::Development),
725752
deprecated: Some(Deprecated::Obsoleted {
726753
note: "".to_owned(),
727754
}),
@@ -753,7 +780,7 @@ mod tests {
753780
id: "test".to_owned(),
754781
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
755782
brief: None,
756-
stability: Some(Stability::Deprecated),
783+
stability: Some(Stability::Development),
757784
deprecated: Some(Deprecated::Obsoleted {
758785
note: "".to_owned(),
759786
}),
@@ -781,7 +808,7 @@ mod tests {
781808
id: "test".to_owned(),
782809
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::Strings),
783810
brief: None,
784-
stability: Some(Stability::Deprecated),
811+
stability: Some(Stability::Development),
785812
deprecated: Some(Deprecated::Obsoleted {
786813
note: "".to_owned(),
787814
}),
@@ -831,6 +858,34 @@ mod tests {
831858
result
832859
);
833860

861+
// Stability is set to deprecated.
862+
group.attributes = vec![AttributeSpec::Id {
863+
id: "test".to_owned(),
864+
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
865+
brief: None,
866+
stability: Some(Stability::Deprecated),
867+
deprecated: Some(Deprecated::Obsoleted {
868+
note: "".to_owned(),
869+
}),
870+
examples: Some(Examples::String("test".to_owned())),
871+
tag: None,
872+
requirement_level: Default::default(),
873+
sampling_relevant: None,
874+
note: "".to_owned(),
875+
annotations: None,
876+
}];
877+
let result = group.validate("<test>").into_result_failing_non_fatal();
878+
assert_eq!(
879+
Err(InvalidAttributeWarning {
880+
path_or_url: "<test>".to_owned(),
881+
group_id: "test".to_owned(),
882+
attribute_id: "test".to_owned(),
883+
error: "Attribute stability is set to 'deprecated' which is no longer supported."
884+
.to_owned(),
885+
},),
886+
result
887+
);
888+
834889
// Stability is missing on enum member.
835890
group.attributes = vec![AttributeSpec::Id {
836891
id: "test".to_owned(),
@@ -867,6 +922,43 @@ mod tests {
867922
},),
868923
result
869924
);
925+
926+
// Stability is set to deprecated on enum member.
927+
group.attributes = vec![AttributeSpec::Id {
928+
id: "test".to_owned(),
929+
r#type: AttributeType::Enum {
930+
allow_custom_values: None,
931+
members: vec![EnumEntriesSpec {
932+
id: "member_id".to_owned(),
933+
value: ValueSpec::String("member_value".to_owned()),
934+
brief: None,
935+
note: None,
936+
stability: Some(Stability::Deprecated),
937+
deprecated: None,
938+
}],
939+
},
940+
brief: None,
941+
stability: Some(Stability::Stable),
942+
deprecated: Some(Deprecated::Obsoleted {
943+
note: "".to_owned(),
944+
}),
945+
examples: Some(Examples::String("test".to_owned())),
946+
tag: None,
947+
requirement_level: Default::default(),
948+
sampling_relevant: None,
949+
note: "".to_owned(),
950+
annotations: None,
951+
}];
952+
let result = group.validate("<test>").into_result_failing_non_fatal();
953+
assert_eq!(
954+
Err(InvalidAttributeWarning {
955+
path_or_url: "<test>".to_owned(),
956+
group_id: "test".to_owned(),
957+
attribute_id: "test".to_owned(),
958+
error: "Member member_id stability is set to 'deprecated' which is no longer supported.".to_owned(),
959+
},),
960+
result
961+
);
870962
}
871963

872964
#[test]
@@ -878,7 +970,7 @@ mod tests {
878970
note: "test".to_owned(),
879971
prefix: "".to_owned(),
880972
extends: None,
881-
stability: Some(Stability::Deprecated),
973+
stability: Some(Stability::Development),
882974
deprecated: Some(Deprecated::Obsoleted {
883975
note: "".to_owned(),
884976
}),
@@ -889,7 +981,7 @@ mod tests {
889981
allow_custom_values: Some(true),
890982
},
891983
brief: None,
892-
stability: Some(Stability::Deprecated),
984+
stability: Some(Stability::Development),
893985
deprecated: Some(Deprecated::Obsoleted {
894986
note: "".to_owned(),
895987
}),
@@ -931,7 +1023,7 @@ mod tests {
9311023
allow_custom_values: None,
9321024
},
9331025
brief: None,
934-
stability: Some(Stability::Deprecated),
1026+
stability: Some(Stability::Development),
9351027
deprecated: Some(Deprecated::Obsoleted {
9361028
note: "".to_owned(),
9371029
}),
@@ -956,7 +1048,7 @@ mod tests {
9561048
note: "test".to_owned(),
9571049
prefix: "".to_owned(),
9581050
extends: None,
959-
stability: Some(Stability::Deprecated),
1051+
stability: Some(Stability::Development),
9601052
deprecated: Some(Deprecated::Obsoleted {
9611053
note: "".to_owned(),
9621054
}),
@@ -1317,7 +1409,7 @@ mod tests {
13171409
id: "test".to_owned(),
13181410
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
13191411
brief: None,
1320-
stability: Some(Stability::Deprecated),
1412+
stability: Some(Stability::Development),
13211413
deprecated: Some(Deprecated::Obsoleted {
13221414
note: "".to_owned(),
13231415
}),
@@ -1450,6 +1542,19 @@ mod tests {
14501542
}),
14511543
result
14521544
);
1545+
1546+
group.stability = Some(Stability::Deprecated);
1547+
let result = group.validate("<test>").into_result_failing_non_fatal();
1548+
assert_eq!(
1549+
Err(InvalidGroupStability {
1550+
path_or_url: "<test>".to_owned(),
1551+
group_id: "test".to_owned(),
1552+
error: "Group stability is set to 'deprecated' which is no longer supported."
1553+
.to_owned(),
1554+
}),
1555+
result
1556+
);
1557+
14531558
group.stability = Some(Stability::Development);
14541559
assert!(group
14551560
.validate("<test>")
@@ -1463,7 +1568,7 @@ mod tests {
14631568
id: "test".to_owned(),
14641569
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
14651570
brief: None,
1466-
stability: Some(Stability::Deprecated),
1571+
stability: Some(Stability::Development),
14671572
deprecated: Some(Deprecated::Obsoleted {
14681573
note: "".to_owned(),
14691574
}),

crates/weaver_semconv/src/stability.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::fmt::{Display, Formatter};
1111
#[serde(rename_all = "snake_case")]
1212
pub enum Stability {
1313
/// A deprecated definition.
14+
#[deprecated(note = "This stability level is deprecated.")]
1415
Deprecated,
1516
/// A stable definition.
1617
Stable,
@@ -29,12 +30,12 @@ pub enum Stability {
2930
impl Display for Stability {
3031
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
3132
match self {
32-
Stability::Deprecated => write!(f, "deprecated"),
3333
Stability::Stable => write!(f, "stable"),
3434
Stability::Development => write!(f, "development"),
3535
Stability::Alpha => write!(f, "alpha"),
3636
Stability::Beta => write!(f, "beta"),
3737
Stability::ReleaseCandidate => write!(f, "release_candidate"),
38+
Stability::Deprecated => write!(f, "deprecated"),
3839
}
3940
}
4041
}
@@ -70,7 +71,6 @@ mod tests {
7071

7172
#[test]
7273
fn test_display() {
73-
assert_eq!(Stability::Deprecated.to_string(), "deprecated");
7474
assert_eq!(Stability::Stable.to_string(), "stable");
7575
assert_eq!(Stability::Development.to_string(), "development");
7676
assert_eq!(Stability::Alpha.to_string(), "alpha");

schemas/semconv-syntax.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ extends ::= string
6161
6262
stability ::= "stable"
6363
| "development"
64-
| "deprecated"
6564
| "alpha"
6665
| "beta"
6766
| "release_candidate"

schemas/semconv.schema.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@
596596
"enum": [
597597
"stable",
598598
"development",
599-
"deprecated",
600599
"alpha",
601600
"beta",
602601
"release_candidate"

0 commit comments

Comments
 (0)