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";
|
||||
public static final String FIND_AND_UPDATE_LAYOUT =
|
||||
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 =
|
||||
APPSMITH_SPAN_PREFIX + "extractAndSetExecutableBindingsInGraphEdges";
|
||||
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.exceptions.AppsmithError;
|
||||
import com.appsmith.server.exceptions.AppsmithException;
|
||||
import com.appsmith.server.helpers.ObservationHelperImpl;
|
||||
import com.appsmith.server.helpers.WidgetSpecificUtils;
|
||||
import com.appsmith.server.newpages.base.NewPageService;
|
||||
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.databind.ObjectMapper;
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
import io.micrometer.tracing.Span;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
|
@ -48,6 +50,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import java.util.regex.Pattern;
|
||||
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_AND_UPDATE_LAYOUT;
|
||||
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 ObjectMapper objectMapper;
|
||||
private final ObservationRegistry observationRegistry;
|
||||
private final ObservationHelperImpl observationHelper;
|
||||
|
||||
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";
|
||||
|
|
@ -127,6 +131,12 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
Set<String> widgetNames = new HashSet<>();
|
||||
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
||||
Set<String> escapedWidgetNames = new HashSet<>();
|
||||
|
||||
Span extractAllWidgetNamesAndDynamicBindingsFromDSLSpan =
|
||||
observationHelper.createSpan(EXTRACT_ALL_WIDGET_NAMES_AND_DYNAMIC_BINDINGS_FROM_DSL);
|
||||
|
||||
observationHelper.startSpan(extractAllWidgetNamesAndDynamicBindingsFromDSLSpan, true);
|
||||
|
||||
try {
|
||||
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
||||
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
||||
|
|
@ -136,6 +146,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
.then(Mono.error(t));
|
||||
}
|
||||
|
||||
observationHelper.endSpan(extractAllWidgetNamesAndDynamicBindingsFromDSLSpan, true);
|
||||
|
||||
layout.setWidgetNames(widgetNames);
|
||||
|
||||
if (!escapedWidgetNames.isEmpty()) {
|
||||
|
|
@ -151,7 +163,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
|
||||
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<>());
|
||||
|
||||
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
|
||||
JSONObject finalDsl = dsl;
|
||||
return allOnLoadExecutablesMono
|
||||
|
||||
Mono<LayoutDTO> layoutDTOMono = allOnLoadExecutablesMono
|
||||
.flatMap(allOnLoadExecutables -> {
|
||||
// If there has been an error (e.g. cyclical dependency), then don't update any actions.
|
||||
// This is so that unnecessary updates don't happen to actions while the page is in invalid state.
|
||||
// If there has been an error (e.g. cyclical dependency), then don't update any
|
||||
// actions.
|
||||
// This is so that unnecessary updates don't happen to actions while the page is
|
||||
// in invalid state.
|
||||
if (!validOnLoadExecutables.get()) {
|
||||
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
|
||||
return onLoadExecutablesUtil
|
||||
.updateExecutablesExecuteOnLoad(
|
||||
|
|
@ -201,12 +218,15 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
layout.setLayoutOnLoadActions(onLoadExecutables);
|
||||
layout.setAllOnPageLoadActionNames(executableNames);
|
||||
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.
|
||||
layout.setValidOnPageLoadActions(validOnLoadExecutables.get());
|
||||
|
||||
return onLoadExecutablesUtil
|
||||
.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)
|
||||
.tap(Micrometer.observation(observationRegistry));
|
||||
})
|
||||
|
|
@ -222,6 +242,8 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
return sendUpdateLayoutAnalyticsEvent(creatorId, layoutId, finalDsl, true, null, creatorType)
|
||||
.thenReturn(layoutDTO);
|
||||
});
|
||||
|
||||
return layoutDTOMono;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -326,6 +348,7 @@ public class UpdateLayoutServiceCEImpl implements UpdateLayoutServiceCE {
|
|||
Set<String> widgetNames = new HashSet<>();
|
||||
Map<String, Set<String>> widgetDynamicBindingsMap = new HashMap<>();
|
||||
Set<String> escapedWidgetNames = new HashSet<>();
|
||||
// observationHelper.createSpan()
|
||||
try {
|
||||
dsl = extractAllWidgetNamesAndDynamicBindingsFromDSL(
|
||||
dsl, widgetNames, widgetDynamicBindingsMap, creatorId, layoutId, escapedWidgetNames, creatorType);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.appsmith.server.layouts;
|
||||
|
||||
import com.appsmith.server.applications.base.ApplicationService;
|
||||
import com.appsmith.server.helpers.ObservationHelperImpl;
|
||||
import com.appsmith.server.newpages.base.NewPageService;
|
||||
import com.appsmith.server.onload.internal.OnLoadExecutablesUtil;
|
||||
import com.appsmith.server.services.AnalyticsService;
|
||||
|
|
@ -21,7 +22,8 @@ public class UpdateLayoutServiceImpl extends UpdateLayoutServiceCEImpl implement
|
|||
PagePermission pagePermission,
|
||||
ApplicationService applicationService,
|
||||
ObjectMapper objectMapper,
|
||||
ObservationRegistry observationRegistry) {
|
||||
ObservationRegistry observationRegistry,
|
||||
ObservationHelperImpl observationHelper) {
|
||||
super(
|
||||
onLoadExecutablesUtil,
|
||||
sessionUserService,
|
||||
|
|
@ -30,6 +32,7 @@ public class UpdateLayoutServiceImpl extends UpdateLayoutServiceCEImpl implement
|
|||
pagePermission,
|
||||
applicationService,
|
||||
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.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.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.WIDGET_ENTITY_REFERENCES;
|
||||
import static com.appsmith.external.helpers.MustacheHelper.getPossibleParents;
|
||||
|
|
@ -140,6 +148,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
.toList();
|
||||
})
|
||||
.collectMap(Tuple2::getT1, Tuple2::getT2)
|
||||
.name(EXECUTABLE_NAME_TO_EXECUTABLE_MAP)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.cache();
|
||||
|
||||
Mono<Set<String>> executablesInCreatorContextMono = allExecutablesByCreatorIdFlux
|
||||
|
|
@ -151,14 +161,16 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
|
||||
Mono<Set<ExecutableDependencyEdge>> directlyReferencedExecutablesToGraphMono =
|
||||
addDirectlyReferencedExecutablesToGraph(
|
||||
edgesRef,
|
||||
executablesUsedInDSLRef,
|
||||
bindingsFromExecutablesRef,
|
||||
executablesFoundDuringWalkRef,
|
||||
widgetDynamicBindingsMap,
|
||||
executableNameToExecutableMapMono,
|
||||
executableBindingsInDslRef,
|
||||
evaluatedVersion);
|
||||
edgesRef,
|
||||
executablesUsedInDSLRef,
|
||||
bindingsFromExecutablesRef,
|
||||
executablesFoundDuringWalkRef,
|
||||
widgetDynamicBindingsMap,
|
||||
executableNameToExecutableMapMono,
|
||||
executableBindingsInDslRef,
|
||||
evaluatedVersion)
|
||||
.name(ADD_DIRECTLY_REFERENCED_EXECUTABLES_TO_GRAPH)
|
||||
.tap(Micrometer.observation(observationRegistry));
|
||||
|
||||
// This following `createAllEdgesForPageMono` publisher traverses the executables and widgets to add all
|
||||
// possible edges between all possible entity paths
|
||||
|
|
@ -168,15 +180,17 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
Mono<Set<ExecutableDependencyEdge>> createAllEdgesForPageMono = directlyReferencedExecutablesToGraphMono
|
||||
// Add dependencies of all on page load executables set by the user in the graph
|
||||
.flatMap(updatedEdges -> addExplicitUserSetOnLoadExecutablesToGraph(
|
||||
creatorId,
|
||||
updatedEdges,
|
||||
explicitUserSetOnLoadExecutablesRef,
|
||||
executablesFoundDuringWalkRef,
|
||||
bindingsFromExecutablesRef,
|
||||
executableNameToExecutableMapMono,
|
||||
executableBindingsInDslRef,
|
||||
evaluatedVersion,
|
||||
creatorType))
|
||||
creatorId,
|
||||
updatedEdges,
|
||||
explicitUserSetOnLoadExecutablesRef,
|
||||
executablesFoundDuringWalkRef,
|
||||
bindingsFromExecutablesRef,
|
||||
executableNameToExecutableMapMono,
|
||||
executableBindingsInDslRef,
|
||||
evaluatedVersion,
|
||||
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
|
||||
// find more relationships with other executables (& widgets)
|
||||
.flatMap(updatedEdges -> recursivelyAddExecutablesAndTheirDependentsToGraphFromBindings(
|
||||
|
|
@ -424,7 +438,10 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
}
|
||||
|
||||
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(
|
||||
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;
|
||||
|
||||
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<String, Executable> executableMap = tuple.getT1();
|
||||
// For each binding, here we receive a set of possible references to global entities
|
||||
|
|
@ -626,6 +647,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
bindingsInWidget,
|
||||
evalVersion,
|
||||
executableBindingsInDslRef)
|
||||
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMapMany(Flux::fromIterable)
|
||||
// Add dependencies of the executables found in the DSL in the graph
|
||||
// We are ignoring the widget references at this point
|
||||
|
|
@ -638,6 +661,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
// for on page load
|
||||
executablesUsedInDSLRef.add(possibleEntity.getValidEntityName());
|
||||
return updateExecutableSelfReferencingPaths(possibleEntity)
|
||||
.name(UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMap(executable -> extractAndSetExecutableBindingsInGraphEdges(
|
||||
possibleEntity,
|
||||
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
|
||||
Mono<List<EntityDependencyNode>> findAndAddExecutablesInBindingsMono = getPossibleEntityReferences(
|
||||
executableNameToExecutableMapMono, dynamicBindings, evalVersion)
|
||||
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMapMany(Flux::fromIterable)
|
||||
// Add dependencies of the executables found in the DSL in the graph.
|
||||
.flatMap(possibleEntity -> {
|
||||
if (getExecutableTypes().contains(possibleEntity.getEntityReferenceType())) {
|
||||
return updateExecutableSelfReferencingPaths(possibleEntity)
|
||||
.name(UPDATE_EXECUTABLE_SELF_REFERENCING_PATHS)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.then(extractAndSetExecutableBindingsInGraphEdges(
|
||||
possibleEntity,
|
||||
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.
|
||||
return getUnpublishedOnLoadExecutablesExplicitSetByUserInCreatorContextFlux(creatorId, creatorType)
|
||||
.name(GET_UNPUBLISHED_ON_LOAD_EXECUTABLES_EXPLICIT_SET_BY_USER_IN_CREATOR_CONTEXT)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMap(this::fillSelfReferencingPaths)
|
||||
// Add the vertices and edges to the graph for these executables
|
||||
.flatMap(executable -> {
|
||||
|
|
@ -1084,6 +1115,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
executableBindingsMap.get(bindingPath),
|
||||
evalVersion,
|
||||
bindingsInDsl)
|
||||
.name(GET_POSSIBLE_ENTITY_REFERENCES)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMapMany(Flux::fromIterable)
|
||||
.map(relatedDependencyNode -> {
|
||||
bindingsFromExecutables.add(relatedDependencyNode.getReferenceString());
|
||||
|
|
@ -1114,6 +1147,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
|
|||
return Flux.fromIterable(widgetBindingMap.entrySet())
|
||||
.flatMap(widgetBindingEntries -> getPossibleEntityParentsMap(
|
||||
widgetBindingEntries.getValue(), entityTypes, evalVersion)
|
||||
.name(GET_POSSIBLE_ENTITY_PARENTS_MAP)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.map(possibleParentsMap -> {
|
||||
possibleParentsMap.entrySet().stream().forEach(entry -> {
|
||||
if (entry.getValue() == null || entry.getValue().isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
|||
if (actionDTO.getCollectionId() == null) {
|
||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.thenReturn(updatedAction));
|
||||
} else if (actionDTO.getCollectionId().length() == 0) {
|
||||
// The Action has been removed from existing collection.
|
||||
|
|
@ -91,6 +93,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
|||
actionDTO.setCollectionId(null);
|
||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.thenReturn(updatedAction));
|
||||
});
|
||||
} else {
|
||||
|
|
@ -120,6 +124,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
|||
action1.getId());
|
||||
return this.updateSingleAction(id, actionDTO).flatMap(updatedAction -> updateLayoutService
|
||||
.updatePageLayoutsByPageId(updatedAction.getPageId())
|
||||
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.thenReturn(updatedAction));
|
||||
});
|
||||
}
|
||||
|
|
@ -276,6 +282,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
|||
return newActionService.save(newAction).flatMap(savedAction -> updateLayoutService
|
||||
.updatePageLayoutsByPageId(
|
||||
savedAction.getUnpublishedAction().getPageId())
|
||||
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.thenReturn(newActionService.generateActionByViewMode(savedAction, false)));
|
||||
});
|
||||
}
|
||||
|
|
@ -289,6 +297,8 @@ public class LayoutActionServiceCEImpl implements LayoutActionServiceCE {
|
|||
.deleteUnpublishedAction(id)
|
||||
.flatMap(actionDTO -> Mono.zip(
|
||||
Mono.just(actionDTO), updateLayoutService.updatePageLayoutsByPageId(actionDTO.getPageId())))
|
||||
.name(UPDATE_PAGE_LAYOUT_BY_PAGE_ID)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMap(tuple -> {
|
||||
ActionDTO actionDTO = tuple.getT1();
|
||||
return Mono.just(actionDTO);
|
||||
|
|
|
|||
|
|
@ -375,6 +375,17 @@ public class LayoutCollectionServiceCEImpl implements LayoutCollectionServiceCE
|
|||
.name(DELETE_ACTION)
|
||||
.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
|
||||
.then(newValidActionIdsMono)
|
||||
.flatMap(tuple -> {
|
||||
|
|
@ -392,6 +403,8 @@ public class LayoutCollectionServiceCEImpl implements LayoutCollectionServiceCE
|
|||
});
|
||||
})
|
||||
.flatMap(actionCollection -> actionCollectionService.update(actionCollection.getId(), actionCollection))
|
||||
.tag("lineCount", lineCount.toString())
|
||||
.tag("actionCount", actionCount.toString())
|
||||
.name(ACTION_COLLECTION_UPDATE)
|
||||
.tap(Micrometer.observation(observationRegistry))
|
||||
.flatMap(actionCollectionRepository::setUserPermissionsInObject)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user