chore: Add spans attributes for no of lines and action count (#37001)
## Description Fixes #36995 ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11455841055> > Commit: 7285f3f04c37b0a78cf7fa8b9106c0fb5175bc29 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11455841055&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Tue, 22 Oct 2024 08:35:48 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for layout operations and data extraction to improve functionality. - Introduced observability tracking for various methods to enhance monitoring and performance insights. - **Bug Fixes** - Enhanced error handling and logging for action updates and layout modifications. - **Refactor** - Improved clarity and maintainability of methods related to action collections and layout updates. - **Chores** - Updated method signatures to include new observability parameters for better tracking. - Added metrics for line and action counts in action collection updates. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
4f55f52c7f
commit
dc5fbed66b
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.appsmith.external.constants.spans;
|
||||||
|
|
||||||
|
import com.appsmith.external.constants.spans.ce.OnLoadSpanCE;
|
||||||
|
|
||||||
|
public class OnLoadSpan extends OnLoadSpanCE {}
|
||||||
|
|
@ -15,7 +15,9 @@ public class LayoutSpanCE {
|
||||||
APPSMITH_SPAN_PREFIX + "onLoadExecutablesUtil.updateExecutablesExecuteOnLoad";
|
APPSMITH_SPAN_PREFIX + "onLoadExecutablesUtil.updateExecutablesExecuteOnLoad";
|
||||||
public static final String FIND_AND_UPDATE_LAYOUT =
|
public static final String FIND_AND_UPDATE_LAYOUT =
|
||||||
APPSMITH_SPAN_PREFIX + "onLoadExecutablesUtil.findAndUpdateLayout";
|
APPSMITH_SPAN_PREFIX + "onLoadExecutablesUtil.findAndUpdateLayout";
|
||||||
|
public static final String UNESCAPE_MONGO_SPECIAL_CHARS = APPSMITH_SPAN_PREFIX + "unescapeMongoSpecialCharacters";
|
||||||
|
public static final String EXTRACT_ALL_WIDGET_NAMES_AND_DYNAMIC_BINDINGS_FROM_DSL =
|
||||||
|
APPSMITH_SPAN_PREFIX + "extractAllWidgetNamesAndDynamicBindingsFromDSL";
|
||||||
public static final String EXTRACT_AND_SET_EXECUTABLE_BINDINGS_IN_GRAPH_EDGES =
|
public static final String EXTRACT_AND_SET_EXECUTABLE_BINDINGS_IN_GRAPH_EDGES =
|
||||||
APPSMITH_SPAN_PREFIX + "extractAndSetExecutableBindingsInGraphEdges";
|
APPSMITH_SPAN_PREFIX + "extractAndSetExecutableBindingsInGraphEdges";
|
||||||
public static final String RECURSIVELY_ADD_EXECUTABLES_AND_THEIR_DEPENDENTS_TO_GRAPH_FROM_BINDINGS =
|
public static final String RECURSIVELY_ADD_EXECUTABLES_AND_THEIR_DEPENDENTS_TO_GRAPH_FROM_BINDINGS =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.appsmith.external.constants.spans.ce;
|
||||||
|
|
||||||
|
import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX;
|
||||||
|
|
||||||
|
public class OnLoadSpanCE {
|
||||||
|
|
||||||
|
public static final String GET_ALL_EXECUTABLES_BY_CREATOR_ID =
|
||||||
|
APPSMITH_SPAN_PREFIX + "getAllExecutablesByCreatorIdFlux";
|
||||||
|
public static final String EXECUTABLE_NAME_TO_EXECUTABLE_MAP =
|
||||||
|
APPSMITH_SPAN_PREFIX + "executableNameToExecutableMap";
|
||||||
|
public static final String EXECUTABLE_IN_CREATOR_CONTEXT = APPSMITH_SPAN_PREFIX + "executablesInCreatorContext";
|
||||||
|
public static final String ADD_DIRECTLY_REFERENCED_EXECUTABLES_TO_GRAPH =
|
||||||
|
APPSMITH_SPAN_PREFIX + "addDirectlyReferencedExecutablesToGraph";
|
||||||
|
public static final String GET_POSSIBLE_ENTITY_REFERENCES = APPSMITH_SPAN_PREFIX + "getPossibleEntityReferences";
|
||||||
|
public static final String UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS =
|
||||||
|
APPSMITH_SPAN_PREFIX + "updateExecutableSelfReferencingPaths";
|
||||||
|
public static final String GET_POSSIBLE_ENTITY_PARENTS_MAP = APPSMITH_SPAN_PREFIX + "getPossibleEntityParentsMap";
|
||||||
|
public static final String ADD_EXPLICIT_USER_SET_ON_LOAD_EXECUTABLES_TO_GRAPH =
|
||||||
|
APPSMITH_SPAN_PREFIX + "addExplicitUserSetOnLoadExecutablesToGraph";
|
||||||
|
public static final String GET_UNPUBLISHED_ON_LOAD_EXECUTABLES_EXPLICIT_SET_BY_USER_IN_CREATOR_CONTEXT =
|
||||||
|
APPSMITH_SPAN_PREFIX + "getUnpublishedOnLoadExecutablesExplicitSetByUserInCreatorContext";
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ import com.appsmith.server.dtos.LayoutDTO;
|
||||||
import com.appsmith.server.dtos.UpdateMultiplePageLayoutDTO;
|
import com.appsmith.server.dtos.UpdateMultiplePageLayoutDTO;
|
||||||
import com.appsmith.server.exceptions.AppsmithError;
|
import com.appsmith.server.exceptions.AppsmithError;
|
||||||
import com.appsmith.server.exceptions.AppsmithException;
|
import com.appsmith.server.exceptions.AppsmithException;
|
||||||
|
import com.appsmith.server.helpers.ObservationHelperImpl;
|
||||||
import com.appsmith.server.helpers.WidgetSpecificUtils;
|
import com.appsmith.server.helpers.WidgetSpecificUtils;
|
||||||
import com.appsmith.server.newpages.base.NewPageService;
|
import com.appsmith.server.newpages.base.NewPageService;
|
||||||
import com.appsmith.server.onload.internal.OnLoadExecutablesUtil;
|
import com.appsmith.server.onload.internal.OnLoadExecutablesUtil;
|
||||||
|
|
@ -26,6 +27,7 @@ import com.appsmith.server.solutions.PagePermission;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.micrometer.observation.ObservationRegistry;
|
import io.micrometer.observation.ObservationRegistry;
|
||||||
|
import io.micrometer.tracing.Span;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.minidev.json.JSONObject;
|
import net.minidev.json.JSONObject;
|
||||||
|
|
@ -48,6 +50,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.appsmith.external.constants.spans.LayoutSpan.EXTRACT_ALL_WIDGET_NAMES_AND_DYNAMIC_BINDINGS_FROM_DSL;
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.FIND_ALL_ON_LOAD_EXECUTABLES;
|
import static com.appsmith.external.constants.spans.LayoutSpan.FIND_ALL_ON_LOAD_EXECUTABLES;
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.FIND_AND_UPDATE_LAYOUT;
|
import static com.appsmith.external.constants.spans.LayoutSpan.FIND_AND_UPDATE_LAYOUT;
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.UPDATE_EXECUTABLES_EXECUTE_ONLOAD;
|
import static com.appsmith.external.constants.spans.LayoutSpan.UPDATE_EXECUTABLES_EXECUTE_ONLOAD;
|
||||||
|
|
@ -70,6 +73,7 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
private final ApplicationService applicationService;
|
private final ApplicationService applicationService;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final ObservationRegistry observationRegistry;
|
private final ObservationRegistry observationRegistry;
|
||||||
|
private final ObservationHelperImpl observationHelper;
|
||||||
|
|
||||||
private final String layoutOnLoadActionErrorToastMessage =
|
private final String layoutOnLoadActionErrorToastMessage =
|
||||||
"A cyclic dependency error has been encountered on current page, \nqueries on page load will not run. \n Please check debugger and Appsmith documentation for more information";
|
"A cyclic dependency error has been encountered on current page, \nqueries on page load will not run. \n Please check debugger and Appsmith documentation for more information";
|
||||||
|
|
@ -127,6 +131,12 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
Set<String> widgetNames = new HashSet<>();
|
Set<String> widgetNames = new HashSet<>();
|
||||||
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
||||||
Set<String> escapedWidgetNames = new HashSet<>();
|
Set<String> escapedWidgetNames = new HashSet<>();
|
||||||
|
|
||||||
|
Span extractAllWidgetNamesAndDynamicBindingsFromDSLSpan =
|
||||||
|
observationHelper.createSpan(EXTRACT_ALL_WIDGET_NAMES_AND_DYNAMIC_BINDINGS_FROM_DSL);
|
||||||
|
|
||||||
|
observationHelper.startSpan(extractAllWidgetNamesAndDynamicBindingsFromDSLSpan, true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
||||||
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
||||||
|
|
@ -136,6 +146,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
.then(Mono.error(t));
|
.then(Mono.error(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
observationHelper.endSpan(extractAllWidgetNamesAndDynamicBindingsFromDSLSpan, true);
|
||||||
|
|
||||||
layout.setWidgetNames(widgetNames);
|
layout.setWidgetNames(widgetNames);
|
||||||
|
|
||||||
if (!escapedWidgetNames.isEmpty()) {
|
if (!escapedWidgetNames.isEmpty()) {
|
||||||
|
|
@ -151,7 +163,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
|
|
||||||
AtomicReference<Boolean> validOnLoadExecutables = new AtomicReference<>(Boolean.TRUE);
|
AtomicReference<Boolean> validOnLoadExecutables = new AtomicReference<>(Boolean.TRUE);
|
||||||
|
|
||||||
// setting the layoutOnLoadActionActionErrors to empty to remove the existing errors before new DAG calculation.
|
// setting the layoutOnLoadActionActionErrors to empty to remove the existing
|
||||||
|
// errors before new DAG calculation.
|
||||||
layout.setLayoutOnLoadActionErrors(new ArrayList<>());
|
layout.setLayoutOnLoadActionErrors(new ArrayList<>());
|
||||||
|
|
||||||
Mono<List<Set<DslExecutableDTO>>> allOnLoadExecutablesMono = onLoadExecutablesUtil
|
Mono<List<Set<DslExecutableDTO>>> allOnLoadExecutablesMono = onLoadExecutablesUtil
|
||||||
|
|
@ -180,14 +193,18 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
|
|
||||||
// First update the actions and set execute on load to true
|
// First update the actions and set execute on load to true
|
||||||
JSONObject finalDsl = dsl;
|
JSONObject finalDsl = dsl;
|
||||||
return allOnLoadExecutablesMono
|
|
||||||
|
Mono<LayoutDTO> layoutDTOMono = allOnLoadExecutablesMono
|
||||||
.flatMap(allOnLoadExecutables -> {
|
.flatMap(allOnLoadExecutables -> {
|
||||||
// If there has been an error (e.g. cyclical dependency), then don't update any actions.
|
// If there has been an error (e.g. cyclical dependency), then don't update any
|
||||||
// This is so that unnecessary updates don't happen to actions while the page is in invalid state.
|
// actions.
|
||||||
|
// This is so that unnecessary updates don't happen to actions while the page is
|
||||||
|
// in invalid state.
|
||||||
if (!validOnLoadExecutables.get()) {
|
if (!validOnLoadExecutables.get()) {
|
||||||
return Mono.just(allOnLoadExecutables);
|
return Mono.just(allOnLoadExecutables);
|
||||||
}
|
}
|
||||||
// Update these executables to be executed on load, unless the user has touched the executeOnLoad
|
// Update these executables to be executed on load, unless the user has touched
|
||||||
|
// the executeOnLoad
|
||||||
// setting for this
|
// setting for this
|
||||||
return onLoadExecutablesUtil
|
return onLoadExecutablesUtil
|
||||||
.updateExecutablesExecuteOnLoad(
|
.updateExecutablesExecuteOnLoad(
|
||||||
|
|
@ -201,12 +218,15 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
layout.setLayoutOnLoadActions(onLoadExecutables);
|
layout.setLayoutOnLoadActions(onLoadExecutables);
|
||||||
layout.setAllOnPageLoadActionNames(executableNames);
|
layout.setAllOnPageLoadActionNames(executableNames);
|
||||||
layout.setActionsUsedInDynamicBindings(executablesUsedInDSL);
|
layout.setActionsUsedInDynamicBindings(executablesUsedInDSL);
|
||||||
// The below field is to ensure that we record if the page load actions computation was
|
// The below field is to ensure that we record if the page load actions
|
||||||
|
// computation was
|
||||||
// valid when last stored in the database.
|
// valid when last stored in the database.
|
||||||
layout.setValidOnPageLoadActions(validOnLoadExecutables.get());
|
layout.setValidOnPageLoadActions(validOnLoadExecutables.get());
|
||||||
|
|
||||||
return onLoadExecutablesUtil
|
return onLoadExecutablesUtil
|
||||||
.findAndUpdateLayout(creatorId, creatorType, layoutId, layout)
|
.findAndUpdateLayout(creatorId, creatorType, layoutId, layout)
|
||||||
|
.tag("no_of_widgets", String.valueOf(widgetNames.size()))
|
||||||
|
.tag("no_of_executables", String.valueOf(executableNames.size()))
|
||||||
.name(FIND_AND_UPDATE_LAYOUT)
|
.name(FIND_AND_UPDATE_LAYOUT)
|
||||||
.tap(Micrometer.observation(observationRegistry));
|
.tap(Micrometer.observation(observationRegistry));
|
||||||
})
|
})
|
||||||
|
|
@ -222,6 +242,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
return sendUpdateLayoutAnalyticsEvent(creatorId, layoutId, finalDsl, true, null, creatorType)
|
return sendUpdateLayoutAnalyticsEvent(creatorId, layoutId, finalDsl, true, null, creatorType)
|
||||||
.thenReturn(layoutDTO);
|
.thenReturn(layoutDTO);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return layoutDTOMono;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -326,6 +348,7 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
||||||
Set<String> widgetNames = new HashSet<>();
|
Set<String> widgetNames = new HashSet<>();
|
||||||
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
||||||
Set<String> escapedWidgetNames = new HashSet<>();
|
Set<String> escapedWidgetNames = new HashSet<>();
|
||||||
|
// observationHelper.createSpan()
|
||||||
try {
|
try {
|
||||||
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
||||||
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.appsmith.server.layouts;
|
package com.appsmith.server.layouts;
|
||||||
|
|
||||||
import com.appsmith.server.applications.base.ApplicationService;
|
import com.appsmith.server.applications.base.ApplicationService;
|
||||||
|
import com.appsmith.server.helpers.ObservationHelperImpl;
|
||||||
import com.appsmith.server.newpages.base.NewPageService;
|
import com.appsmith.server.newpages.base.NewPageService;
|
||||||
import com.appsmith.server.onload.internal.OnLoadExecutablesUtil;
|
import com.appsmith.server.onload.internal.OnLoadExecutablesUtil;
|
||||||
import com.appsmith.server.services.AnalyticsService;
|
import com.appsmith.server.services.AnalyticsService;
|
||||||
|
|
@ -21,7 +22,8 @@ public class UpdateLayoutServiceImpl extends UpdateLayoutServiceCEImpl implement
|
||||||
PagePermission pagePermission,
|
PagePermission pagePermission,
|
||||||
ApplicationService applicationService,
|
ApplicationService applicationService,
|
||||||
ObjectMapper objectMapper,
|
ObjectMapper objectMapper,
|
||||||
ObservationRegistry observationRegistry) {
|
ObservationRegistry observationRegistry,
|
||||||
|
ObservationHelperImpl observationHelper) {
|
||||||
super(
|
super(
|
||||||
onLoadExecutablesUtil,
|
onLoadExecutablesUtil,
|
||||||
sessionUserService,
|
sessionUserService,
|
||||||
|
|
@ -30,6 +32,7 @@ public class UpdateLayoutServiceImpl extends UpdateLayoutServiceCEImpl implement
|
||||||
pagePermission,
|
pagePermission,
|
||||||
applicationService,
|
applicationService,
|
||||||
objectMapper,
|
objectMapper,
|
||||||
observationRegistry);
|
observationRegistry,
|
||||||
|
observationHelper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,14 @@ import static com.appsmith.external.constants.spans.LayoutSpan.COMPUTE_ON_PAGE_L
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.EXTRACT_AND_SET_EXECUTABLE_BINDINGS_IN_GRAPH_EDGES;
|
import static com.appsmith.external.constants.spans.LayoutSpan.EXTRACT_AND_SET_EXECUTABLE_BINDINGS_IN_GRAPH_EDGES;
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.FILTER_AND_TRANSFORM_SCHEDULING_ORDER_TO_DTO;
|
import static com.appsmith.external.constants.spans.LayoutSpan.FILTER_AND_TRANSFORM_SCHEDULING_ORDER_TO_DTO;
|
||||||
import static com.appsmith.external.constants.spans.LayoutSpan.RECURSIVELY_ADD_EXECUTABLES_AND_THEIR_DEPENDENTS_TO_GRAPH_FROM_BINDINGS;
|
import static com.appsmith.external.constants.spans.LayoutSpan.RECURSIVELY_ADD_EXECUTABLES_AND_THEIR_DEPENDENTS_TO_GRAPH_FROM_BINDINGS;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.ADD_DIRECTLY_REFERENCED_EXECUTABLES_TO_GRAPH;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.ADD_EXPLICIT_USER_SET_ON_LOAD_EXECUTABLES_TO_GRAPH;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.EXECUTABLE_NAME_TO_EXECUTABLE_MAP;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.GET_ALL_EXECUTABLES_BY_CREATOR_ID;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.GET_POSSIBLE_ENTITY_PARENTS_MAP;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.GET_POSSIBLE_ENTITY_REFERENCES;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.GET_UNPUBLISHED_ON_LOAD_EXECUTABLES_EXPLICIT_SET_BY_USER_IN_CREATOR_CONTEXT;
|
||||||
|
import static com.appsmith.external.constants.spans.OnLoadSpan.UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS;
|
||||||
import static com.appsmith.external.helpers.MustacheHelper.EXECUTABLE_ENTITY_REFERENCES;
|
import static com.appsmith.external.helpers.MustacheHelper.EXECUTABLE_ENTITY_REFERENCES;
|
||||||
import static com.appsmith.external.helpers.MustacheHelper.WIDGET_ENTITY_REFERENCES;
|
import static com.appsmith.external.helpers.MustacheHelper.WIDGET_ENTITY_REFERENCES;
|
||||||
import static com.appsmith.external.helpers.MustacheHelper.getPossibleParents;
|
import static com.appsmith.external.helpers.MustacheHelper.getPossibleParents;
|
||||||
|
|
@ -140,6 +148,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
.toList();
|
.toList();
|
||||||
})
|
})
|
||||||
.collectMap(Tuple2::getT1, Tuple2::getT2)
|
.collectMap(Tuple2::getT1, Tuple2::getT2)
|
||||||
|
.name(EXECUTABLE_NAME_TO_EXECUTABLE_MAP)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.cache();
|
.cache();
|
||||||
|
|
||||||
Mono<Set<String>> executablesInCreatorContextMono = allExecutablesByCreatorIdFlux
|
Mono<Set<String>> executablesInCreatorContextMono = allExecutablesByCreatorIdFlux
|
||||||
|
|
@ -158,7 +168,9 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
widgetDynamicBindingsMap,
|
widgetDynamicBindingsMap,
|
||||||
executableNameToExecutableMapMono,
|
executableNameToExecutableMapMono,
|
||||||
executableBindingsInDslRef,
|
executableBindingsInDslRef,
|
||||||
evaluatedVersion);
|
evaluatedVersion)
|
||||||
|
.name(ADD_DIRECTLY_REFERENCED_EXECUTABLES_TO_GRAPH)
|
||||||
|
.tap(Micrometer.observation(observationRegistry));
|
||||||
|
|
||||||
// This following `createAllEdgesForPageMono` publisher traverses the executables and widgets to add all
|
// This following `createAllEdgesForPageMono` publisher traverses the executables and widgets to add all
|
||||||
// possible edges between all possible entity paths
|
// possible edges between all possible entity paths
|
||||||
|
|
@ -176,7 +188,9 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
executableNameToExecutableMapMono,
|
executableNameToExecutableMapMono,
|
||||||
executableBindingsInDslRef,
|
executableBindingsInDslRef,
|
||||||
evaluatedVersion,
|
evaluatedVersion,
|
||||||
creatorType))
|
creatorType)
|
||||||
|
.name(ADD_EXPLICIT_USER_SET_ON_LOAD_EXECUTABLES_TO_GRAPH)
|
||||||
|
.tap(Micrometer.observation(observationRegistry)))
|
||||||
// For all the executables found so far, recursively walk the dynamic bindings of the executables to
|
// For all the executables found so far, recursively walk the dynamic bindings of the executables to
|
||||||
// find more relationships with other executables (& widgets)
|
// find more relationships with other executables (& widgets)
|
||||||
.flatMap(updatedEdges -> recursivelyAddExecutablesAndTheirDependentsToGraphFromBindings(
|
.flatMap(updatedEdges -> recursivelyAddExecutablesAndTheirDependentsToGraphFromBindings(
|
||||||
|
|
@ -424,7 +438,10 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Flux<Executable> getAllExecutablesByCreatorIdFlux(String creatorId, CreatorContextType creatorType) {
|
protected Flux<Executable> getAllExecutablesByCreatorIdFlux(String creatorId, CreatorContextType creatorType) {
|
||||||
return pageExecutableOnLoadService.getAllExecutablesByCreatorIdFlux(creatorId);
|
return pageExecutableOnLoadService
|
||||||
|
.getAllExecutablesByCreatorIdFlux(creatorId)
|
||||||
|
.name(GET_ALL_EXECUTABLES_BY_CREATOR_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -488,7 +505,9 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
*/
|
*/
|
||||||
private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(
|
private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(
|
||||||
Mono<Map<String, Executable>> executableNameToExecutableMapMono, Set<String> bindings, int evalVersion) {
|
Mono<Map<String, Executable>> executableNameToExecutableMapMono, Set<String> bindings, int evalVersion) {
|
||||||
return getPossibleEntityReferences(executableNameToExecutableMapMono, bindings, evalVersion, null);
|
return getPossibleEntityReferences(executableNameToExecutableMapMono, bindings, evalVersion, null)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||||
|
.tap(Micrometer.observation(observationRegistry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -511,7 +530,9 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
final int entityTypes = EXECUTABLE_ENTITY_REFERENCES | WIDGET_ENTITY_REFERENCES;
|
final int entityTypes = EXECUTABLE_ENTITY_REFERENCES | WIDGET_ENTITY_REFERENCES;
|
||||||
|
|
||||||
return executableNameToExecutableMono
|
return executableNameToExecutableMono
|
||||||
.zipWith(getPossibleEntityParentsMap(bindings, entityTypes, evalVersion))
|
.zipWith(getPossibleEntityParentsMap(bindings, entityTypes, evalVersion)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_PARENTS_MAP)
|
||||||
|
.tap(Micrometer.observation(observationRegistry)))
|
||||||
.map(tuple -> {
|
.map(tuple -> {
|
||||||
Map<String, Executable> executableMap = tuple.getT1();
|
Map<String, Executable> executableMap = tuple.getT1();
|
||||||
// For each binding, here we receive a set of possible references to global entities
|
// For each binding, here we receive a set of possible references to global entities
|
||||||
|
|
@ -626,6 +647,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
bindingsInWidget,
|
bindingsInWidget,
|
||||||
evalVersion,
|
evalVersion,
|
||||||
executableBindingsInDslRef)
|
executableBindingsInDslRef)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMapMany(Flux::fromIterable)
|
.flatMapMany(Flux::fromIterable)
|
||||||
// Add dependencies of the executables found in the DSL in the graph
|
// Add dependencies of the executables found in the DSL in the graph
|
||||||
// We are ignoring the widget references at this point
|
// We are ignoring the widget references at this point
|
||||||
|
|
@ -638,6 +661,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
// for on page load
|
// for on page load
|
||||||
executablesUsedInDSLRef.add(possibleEntity.getValidEntityName());
|
executablesUsedInDSLRef.add(possibleEntity.getValidEntityName());
|
||||||
return updateExecutableSelfReferencingPaths(possibleEntity)
|
return updateExecutableSelfReferencingPaths(possibleEntity)
|
||||||
|
.name(UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMap(executable -> extractAndSetExecutableBindingsInGraphEdges(
|
.flatMap(executable -> extractAndSetExecutableBindingsInGraphEdges(
|
||||||
possibleEntity,
|
possibleEntity,
|
||||||
edgesRef,
|
edgesRef,
|
||||||
|
|
@ -914,11 +939,15 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
// First fetch all the executables in the page whose name matches the words found in all the dynamic bindings
|
// First fetch all the executables in the page whose name matches the words found in all the dynamic bindings
|
||||||
Mono<List<EntityDependencyNode>> findAndAddExecutablesInBindingsMono = getPossibleEntityReferences(
|
Mono<List<EntityDependencyNode>> findAndAddExecutablesInBindingsMono = getPossibleEntityReferences(
|
||||||
executableNameToExecutableMapMono, dynamicBindings, evalVersion)
|
executableNameToExecutableMapMono, dynamicBindings, evalVersion)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMapMany(Flux::fromIterable)
|
.flatMapMany(Flux::fromIterable)
|
||||||
// Add dependencies of the executables found in the DSL in the graph.
|
// Add dependencies of the executables found in the DSL in the graph.
|
||||||
.flatMap(possibleEntity -> {
|
.flatMap(possibleEntity -> {
|
||||||
if (getExecutableTypes().contains(possibleEntity.getEntityReferenceType())) {
|
if (getExecutableTypes().contains(possibleEntity.getEntityReferenceType())) {
|
||||||
return updateExecutableSelfReferencingPaths(possibleEntity)
|
return updateExecutableSelfReferencingPaths(possibleEntity)
|
||||||
|
.name(UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.then(extractAndSetExecutableBindingsInGraphEdges(
|
.then(extractAndSetExecutableBindingsInGraphEdges(
|
||||||
possibleEntity,
|
possibleEntity,
|
||||||
edges,
|
edges,
|
||||||
|
|
@ -981,6 +1010,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
|
|
||||||
// First fetch all the executables which have been tagged as on load by the user explicitly.
|
// First fetch all the executables which have been tagged as on load by the user explicitly.
|
||||||
return getUnpublishedOnLoadExecutablesExplicitSetByUserInCreatorContextFlux(creatorId, creatorType)
|
return getUnpublishedOnLoadExecutablesExplicitSetByUserInCreatorContextFlux(creatorId, creatorType)
|
||||||
|
.name(GET_UNPUBLISHED_ON_LOAD_EXECUTABLES_EXPLICIT_SET_BY_USER_IN_CREATOR_CONTEXT)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMap(this::fillSelfReferencingPaths)
|
.flatMap(this::fillSelfReferencingPaths)
|
||||||
// Add the vertices and edges to the graph for these executables
|
// Add the vertices and edges to the graph for these executables
|
||||||
.flatMap(executable -> {
|
.flatMap(executable -> {
|
||||||
|
|
@ -1084,6 +1115,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
executableBindingsMap.get(bindingPath),
|
executableBindingsMap.get(bindingPath),
|
||||||
evalVersion,
|
evalVersion,
|
||||||
bindingsInDsl)
|
bindingsInDsl)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMapMany(Flux::fromIterable)
|
.flatMapMany(Flux::fromIterable)
|
||||||
.map(relatedDependencyNode -> {
|
.map(relatedDependencyNode -> {
|
||||||
bindingsFromExecutables.add(relatedDependencyNode.getReferenceString());
|
bindingsFromExecutables.add(relatedDependencyNode.getReferenceString());
|
||||||
|
|
@ -1114,6 +1147,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
||||||
return Flux.fromIterable(widgetBindingMap.entrySet())
|
return Flux.fromIterable(widgetBindingMap.entrySet())
|
||||||
.flatMap(widgetBindingEntries -> getPossibleEntityParentsMap(
|
.flatMap(widgetBindingEntries -> getPossibleEntityParentsMap(
|
||||||
widgetBindingEntries.getValue(), entityTypes, evalVersion)
|
widgetBindingEntries.getValue(), entityTypes, evalVersion)
|
||||||
|
.name(GET_POSSIBLE_ENTITY_PARENTS_MAP)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.map(possibleParentsMap -> {
|
.map(possibleParentsMap -> {
|
||||||
possibleParentsMap.entrySet().stream().forEach(entry -> {
|
possibleParentsMap.entrySet().stream().forEach(entry -> {
|
||||||
if (entry.getValue() == null || entry.getValue().isEmpty()) {
|
if (entry.getValue() == null || entry.getValue().isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
||||||
if (actionDTO.getCollectionId() == null) {
|
if (actionDTO.getCollectionId() == null) {
|
||||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||||
|
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.thenReturn(updatedAction));
|
.thenReturn(updatedAction));
|
||||||
} else if (actionDTO.getCollectionId().length() == 0) {
|
} else if (actionDTO.getCollectionId().length() == 0) {
|
||||||
// The Action has been removed from existing collection.
|
// The Action has been removed from existing collection.
|
||||||
|
|
@ -91,6 +93,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
||||||
actionDTO.setCollectionId(null);
|
actionDTO.setCollectionId(null);
|
||||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||||
|
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.thenReturn(updatedAction));
|
.thenReturn(updatedAction));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -120,6 +124,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
||||||
action1.getId());
|
action1.getId());
|
||||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||||
|
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.thenReturn(updatedAction));
|
.thenReturn(updatedAction));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -276,6 +282,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
||||||
return newActionService.save(newAction).flatMap(savedAction -> updateLayoutService
|
return newActionService.save(newAction).flatMap(savedAction -> updateLayoutService
|
||||||
.updatePageLayoutsByPageId(
|
.updatePageLayoutsByPageId(
|
||||||
savedAction.getUnpublishedAction().getPageId())
|
savedAction.getUnpublishedAction().getPageId())
|
||||||
|
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.thenReturn(newActionService.generateActionByViewMode(savedAction, false)));
|
.thenReturn(newActionService.generateActionByViewMode(savedAction, false)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -289,6 +297,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
||||||
.deleteUnpublishedAction(id)
|
.deleteUnpublishedAction(id)
|
||||||
.flatMap(actionDTO -> Mono.zip(
|
.flatMap(actionDTO -> Mono.zip(
|
||||||
Mono.just(actionDTO), updateLayoutService.updatePageLayoutsByPageId(actionDTO.getPageId())))
|
Mono.just(actionDTO), updateLayoutService.updatePageLayoutsByPageId(actionDTO.getPageId())))
|
||||||
|
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||||
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMap(tuple -> {
|
.flatMap(tuple -> {
|
||||||
ActionDTO actionDTO = tuple.getT1();
|
ActionDTO actionDTO = tuple.getT1();
|
||||||
return Mono.just(actionDTO);
|
return Mono.just(actionDTO);
|
||||||
|
|
|
||||||
|
|
@ -375,6 +375,17 @@ public class LayoutCollectionServiceCEImpl implements LayoutCollectionServiceCE
|
||||||
.name(DELETE_ACTION)
|
.name(DELETE_ACTION)
|
||||||
.tap(Micrometer.observation(observationRegistry));
|
.tap(Micrometer.observation(observationRegistry));
|
||||||
|
|
||||||
|
String body = actionCollectionDTO.getBody();
|
||||||
|
Number lineCount = 0;
|
||||||
|
if (body != null && !body.isEmpty()) {
|
||||||
|
lineCount = body.split("\n").length;
|
||||||
|
}
|
||||||
|
Number actionCount = 0;
|
||||||
|
if (actionCollectionDTO.getActions() != null
|
||||||
|
&& !actionCollectionDTO.getActions().isEmpty()) {
|
||||||
|
actionCount = actionCollectionDTO.getActions().size();
|
||||||
|
}
|
||||||
|
|
||||||
return deleteNonExistingActionMono
|
return deleteNonExistingActionMono
|
||||||
.then(newValidActionIdsMono)
|
.then(newValidActionIdsMono)
|
||||||
.flatMap(tuple -> {
|
.flatMap(tuple -> {
|
||||||
|
|
@ -392,6 +403,8 @@ public class LayoutCollectionServiceCEImpl implements LayoutCollectionServiceCE
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.flatMap(actionCollection -> actionCollectionService.update(actionCollection.getId(), actionCollection))
|
.flatMap(actionCollection -> actionCollectionService.update(actionCollection.getId(), actionCollection))
|
||||||
|
.tag("lineCount", lineCount.toString())
|
||||||
|
.tag("actionCount", actionCount.toString())
|
||||||
.name(ACTION_COLLECTION_UPDATE)
|
.name(ACTION_COLLECTION_UPDATE)
|
||||||
.tap(Micrometer.observation(observationRegistry))
|
.tap(Micrometer.observation(observationRegistry))
|
||||||
.flatMap(actionCollectionRepository::setUserPermissionsInObject)
|
.flatMap(actionCollectionRepository::setUserPermissionsInObject)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user