-
Notifications
You must be signed in to change notification settings - Fork 213
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
feat: implement policy-monitor #3456
feat: implement policy-monitor #3456
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3456 +/- ##
==========================================
- Coverage 72.11% 71.70% -0.41%
==========================================
Files 836 841 +5
Lines 16989 17002 +13
Branches 947 950 +3
==========================================
- Hits 12252 12192 -60
- Misses 4333 4407 +74
+ Partials 404 403 -1
☔ View full report in Codecov by Sentry. |
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.
Looks good for a first iteration. I guess the larger issue of potentially missing additional data on the PolicyContext
can be tackled in a subsequent iteration. Maybe that additional data could be persisted in a PolicyMonitorEntry
?
.additional(ContractAgreement.class, contractAgreement) | ||
.build(); | ||
|
||
var result = policyEngine.evaluate("transfer.process", policy, policyContext); |
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.
we already have that defined as constant on the ContractValidationService
. Either we re-use that (possibly moving to a more common class), or we re-declare a constant here and annotate with @PolicyScope
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.
will note this on my todo for the next PR 👍
...src/main/java/org/eclipse/edc/connector/policy/monitor/manager/PolicyMonitorManagerImpl.java
Show resolved
Hide resolved
...src/main/java/org/eclipse/edc/connector/policy/monitor/manager/PolicyMonitorManagerImpl.java
Show resolved
Hide resolved
...src/main/java/org/eclipse/edc/connector/policy/monitor/store/InMemoryPolicyMonitorStore.java
Show resolved
Hide resolved
...src/main/java/org/eclipse/edc/connector/policy/monitor/manager/PolicyMonitorManagerImpl.java
Show resolved
Hide resolved
...-core/src/main/java/org/eclipse/edc/connector/policy/monitor/subscriber/StartMonitoring.java
Show resolved
Hide resolved
...spi/src/main/java/org/eclipse/edc/connector/policy/monitor/spi/PolicyMonitorEntryStates.java
Show resolved
Hide resolved
...nitor-spi/src/main/java/org/eclipse/edc/connector/policy/monitor/spi/PolicyMonitorEntry.java
Show resolved
Hide resolved
...tor-spi/src/main/java/org/eclipse/edc/connector/policy/monitor/spi/PolicyMonitorManager.java
Outdated
Show resolved
Hide resolved
...tor-core/src/main/java/org/eclipse/edc/connector/core/entity/AbstractStateEntityManager.java
Show resolved
Hide resolved
...tor-core/src/main/java/org/eclipse/edc/connector/core/entity/AbstractStateEntityManager.java
Outdated
Show resolved
Hide resolved
spi/common/core-spi/src/main/java/org/eclipse/edc/spi/entity/StateEntityManager.java
Outdated
Show resolved
Hide resolved
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.
Just a few minor things, particularly adding documentation to the classes.
|
||
import org.eclipse.edc.spi.persistence.StateEntityStore; | ||
|
||
public interface PolicyMonitorStore extends StateEntityStore<PolicyMonitorEntry> { |
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.
Do we need a dedicated store for that?
Can't we just browse the active ContractAgreement
(i.e. not expired nor canceled) stored in the contract negotiation store?
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.
we need the state machine for reliability, scalability and performances (the reason was detailed in the related DR)
furthermore, ContractAgreement
s don't have an "expired" or "canceled" state, is a condition that needs to be verified on the policy, so otherwise we'd need to query every ContractAgreement
every time as there's no way to mark them "expired" nor "canceled".
1479547
to
1a20f85
Compare
1a20f85
to
e4ca9c7
Compare
e4ca9c7
to
065bcab
Compare
065bcab
to
b87ff07
Compare
* feat: implement policy-monitor * Pull store to AbstractStateEntityManager * PR remarks
What this PR changes/adds
Implements the first version of the
PolicyMonitor
: embedded in the controlplane, with in-memory storageWhy it does that
streaming data transfer
Further notes
StateManager
hierarchy, that permits to avoid some duplication, this can be pushed a little further, will do it in the subsequent PRsEndToEndKafkaTransferTest
is showing the PolicyMonitor in action, defining a policy that expires in 10s, the transfer gets completed. there still is a missing part to actually shut down the data flow, described in this issue: policy-monitor: data flow should be stopped on transfer completion #3453InMemoryPolicyMonitorStore
is not tested as it is a simple wrapper of theInMemoryStatefulEntityStore
, tests will be added with the implementation of the Sql storage (policy-monitor: sql storage #3447 )Linked Issue(s)
Closes #3445
Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.