Skip to content
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

Weaver Policy Engine #87

Merged
merged 31 commits into from
Apr 12, 2024
Merged

Weaver Policy Engine #87

merged 31 commits into from
Apr 12, 2024

Conversation

lquerel
Copy link
Contributor

@lquerel lquerel commented Apr 5, 2024

This PR is based the proposal #81.

This initial implementation (based on the regorus policy engine) allows for the detection of violations against best practices within a semantic convention registry (before the resolution phase) through one or several policy files (in rego format). A future PR will enable the application of policies after the registry's resolution to detect other types of violations.

A detailed description of the operating principle can be found in the README.md of the weaver_policy_engine crate.

The impact on performance from evaluating policies on all files in the registry is imperceptible.

Future developments:

  • Allow the application of policies after the registry resolution phase.
  • Enable specifying two versions of the same registry to apply policies comparing the schema evolution of groups, attributes, or any other signals.
  • Currently, only the weaver registry check command has the capability to apply these policies. Support for other commands will be added in future PRs.

Note: Due to a conflict issue with serde_json, this PR references a fork of the regorus project. A description of the problem can be found here. The described issue is not a major problem, and I believe it is temporary.

@lquerel lquerel added the enhancement New feature or request label Apr 5, 2024
@lquerel lquerel self-assigned this Apr 5, 2024
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
crates/weaver_policy_engine/src/engine.rs Fixed Show fixed Hide fixed
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 75.86207% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 63.6%. Comparing base (acf6fd0) to head (a5ca1d2).

Files Patch % Lines
crates/weaver_checker/src/lib.rs 76.3% 9 Missing ⚠️
crates/weaver_resolver/src/lib.rs 73.5% 9 Missing ⚠️
crates/weaver_semconv_gen/src/lib.rs 40.0% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main     #87   +/-   ##
=====================================
  Coverage   63.6%   63.6%           
=====================================
  Files         54      56    +2     
  Lines       3245    3282   +37     
=====================================
+ Hits        2065    2089   +24     
- Misses      1180    1193   +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lquerel lquerel changed the title [WIP] Weaver Policy Engine Weaver Policy Engine Apr 9, 2024
@lquerel lquerel marked this pull request as ready for review April 9, 2024 19:34
@lquerel lquerel requested a review from jsuereth as a code owner April 9, 2024 19:34
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that was a lot more tearing things apart than I expected, but I think this separation will pay off later!

Thanks for adding this, excited to try it out/expand on it!

src/error.rs Show resolved Hide resolved
@lquerel lquerel merged commit 57e6f1a into open-telemetry:main Apr 12, 2024
18 checks passed
@lquerel lquerel deleted the policy-engine branch April 17, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants