Skip to content

Commit

Permalink
update ApolloAuditSpanAspect
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackBear2003 committed Nov 10, 2023
1 parent fd708f5 commit ef839f2
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public Object around(ProceedingJoinPoint pjp, ApolloAuditLog auditLog) throws Th
String opName = auditLog.name();
try (AutoCloseable scope = api.appendAuditLog(auditLog.type(), opName,
auditLog.description())) {
Object proceed = pjp.proceed();
auditDataInfluenceArg(pjp);
return pjp.proceed();
return proceed;
}
}

Expand Down Expand Up @@ -96,22 +97,18 @@ Method findMethod(ProceedingJoinPoint pjp) {
}

void parseArgAndAppend(String entityName, String fieldName, Object arg) {
if (entityName == null || fieldName == null) {
if (entityName == null || fieldName == null || arg == null) {
return;
}

Collection<Object> parsedList = new ArrayList<>(Collections.emptyList());
if (arg instanceof Collection) {
/* if arg is a collection */
parsedList.addAll((Collection<?>) arg);
for (Object o : (Collection<?>) arg) {
String matchedValue = String.valueOf(o);
api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName, matchedValue);
}
} else {
parsedList.add(arg);
}

for (Object o : parsedList) {
String matchedValue = String.valueOf(o);
api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName,
matchedValue);
String matchedValue = String.valueOf(arg);
api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName, matchedValue);
}
}
}

0 comments on commit ef839f2

Please sign in to comment.