-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(chore) Move backwards compatibility checks to weaver. #1327
(chore) Move backwards compatibility checks to weaver. #1327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like that we're reusing the Rego framework to test our policies, but I think that to properly/fully test them, we need integration in Weaver instead of relying solely on OPA. The reasoning is as follows:
- The names of the policy packages are meaningful for Weaver, unlike with OPA, so ideally, we need to check that too.
- The Rego extensions that we will likely introduce in Weaver over time will only be testable within Weaver.
- This isn't specific to Weaver, but in addition to the tests, we could combine both tests and Rego code coverage to aid the policy review process (code coverage is supported by Regorus).
# Find stable baseline attributes in latest registry. | ||
some attr in baseline_attributes | ||
attr.stability == "stable" | ||
some nattr in registry_attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the instances where rewriting registry_attributes
as shown below will accelerate the rules. Instead of having a list of attributes, we rely on a map of attribute name -> attribute.
registry_attributes := [name: attr |
some g in data.semconv.registry_groups
some attr in g.attributes
name := attr.name
]
Fixes #1039 - Migrate backwards compatibility checks to weaver.
Rules we enforce:
Example errors:
Stable metrics cannot change required/recommended attributes:
Stable metrics cannot change unit type:
Stable metrics cannot become unstable
Metrics cannot be removed
Enums cannot lose stable members
Enum ids cannot change stable status
Enum stable values cannot change (for same id)
Attributes cannot be removed form registry
Stable Attributes cannot change type
Stable attributes cannot become experimental/other.