-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Apply audit log functions to portal using audit-log module #5008
Apply audit log functions to portal using audit-log module #5008
Conversation
Add patch of dealing with collection-type arg when AOP capturing input parameter for "AnyMatched".
Codecov Report
@@ Coverage Diff @@
## master #5008 +/- ##
============================================
+ Coverage 49.27% 49.61% +0.34%
- Complexity 1889 1908 +19
============================================
Files 372 372
Lines 11538 11553 +15
Branches 1123 1127 +4
============================================
+ Hits 5685 5732 +47
+ Misses 5513 5479 -34
- Partials 340 342 +2
|
Some bug happened when create namespace and cluster |
1 similar comment
Some bug happened when create namespace and cluster |
// if arg is a collection | ||
if (arg instanceof Collection) { | ||
for (Object o : ((Collection<?>) arg).toArray()) { | ||
String matchedValue = String.valueOf(o); |
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.
Add some test for those code?
@@ -16,6 +16,8 @@ | |||
*/ | |||
package com.ctrip.framework.apollo.portal.spi.defaultimpl; | |||
|
|||
import com.ctrip.framework.apollo.audit.annotation.ApolloAuditLog; | |||
import com.ctrip.framework.apollo.audit.annotation.OpType; |
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.
please remove those import
@@ -16,6 +16,8 @@ | |||
*/ | |||
package com.ctrip.framework.apollo.portal.spi.defaultimpl; | |||
|
|||
import com.ctrip.framework.apollo.audit.annotation.ApolloAuditLog; | |||
import com.ctrip.framework.apollo.audit.annotation.OpType; |
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.
please remove those import
It seems great only use annotation to collect the audit log! |
} | ||
} | ||
auditDataInfluenceArg(pjp); | ||
return pjp.proceed(); |
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.
Only record the audit log after method executed success,
so auditDataInfluenceArg should after pjp.proceed()?
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 sounds better 🫡
return; | ||
} | ||
|
||
Collection<Object> parsedList = new ArrayList<>(Collections.emptyList()); |
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.
Suggest that iterate arg directly without create a new ArrayList
public void mockAuditMethod( | ||
@ApolloAuditLogDataInfluence | ||
@ApolloAuditLogDataInfluenceTable(tableName = "App") | ||
@ApolloAuditLogDataInfluenceTableField(fieldName = "Name") Object val1, |
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.
add a test case when arg is a collection?
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.
add a test case when arg is a collection?
There is a method to parsing arg, and a test method too, see testParseArgAndAppendCaseCollectionTypeArg
at ApolloAuditSpanAspectTest
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.
LGTM
What's the purpose of this PR
Apply audit log functions to portal using audit-log module's annotations
Which issue(s) this PR fixes:
Fixes ##3505
Brief changelog
add audit-log annotations to Portal for applying audit log functions.
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.