chore: Changes in action execution analytics event (#17021)

This commit is contained in:
Vishnu Gp 2022-09-26 10:11:38 +05:30 committed by GitHub
parent 4e9068ddba
commit c72b8eae2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1017,6 +1017,15 @@ public class NewActionServiceCEImpl extends BaseService<NewActionRepository, New
return result; return result;
} }
/**
* Since we're loading the application and other details from DB *only* for analytics, we check if analytics is
* active before making the call to DB.
* @return
*/
public Boolean isSendExecuteAnalyticsEvent() {
return analyticsService.isActive();
}
private Mono<ActionExecutionRequest> sendExecuteAnalyticsEvent( private Mono<ActionExecutionRequest> sendExecuteAnalyticsEvent(
NewAction action, NewAction action,
ActionDTO actionDTO, ActionDTO actionDTO,
@ -1025,14 +1034,9 @@ public class NewActionServiceCEImpl extends BaseService<NewActionRepository, New
ActionExecutionResult actionExecutionResult, ActionExecutionResult actionExecutionResult,
Long timeElapsed Long timeElapsed
) { ) {
// Since we're loading the application from DB *only* for analytics, we check if analytics is
// active before making the call to DB. if (!isSendExecuteAnalyticsEvent()) {
if (!analyticsService.isActive()) { return Mono.empty();
// This is to have consistency in how the AnalyticsService is being called.
// Even though sendObjectEvent is triggered, AnalyticsService would still reject this and prevent the event
// from being sent to analytics provider if telemetry is disabled.
return analyticsService.sendObjectEvent(AnalyticsEvents.EXECUTE_ACTION, action)
.then(Mono.empty());
} }
ActionExecutionRequest actionExecutionRequest = actionExecutionResult.getRequest(); ActionExecutionRequest actionExecutionRequest = actionExecutionResult.getRequest();
ActionExecutionRequest request; ActionExecutionRequest request;