diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java index b800f3a97707..567a2296b76d 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java @@ -39,4 +39,9 @@ public class ActionSpanCE { public static final String DELETE_ACTION = APPSMITH_SPAN_PREFIX + "delete.action"; public static final String FILL_SELF_REFERENCING_PATHS_ACTION = APPSMITH_SPAN_PREFIX + "action.fillSelfReferencingPaths"; + + public static final String VALIDATE_AND_GENERATE_ACTION_DOMAIN_BASED_ON_CONTEXT = + APPSMITH_SPAN_PREFIX + ACTIONS + "validateAndGenerateActionDomainBasedOnContext"; + public static final String VALIDATE_AND_SAVE_ACTION_TO_REPOSITORY = + APPSMITH_SPAN_PREFIX + ACTIONS + "validateAndSaveActionToRepository"; } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/DatasourceSpanCE.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/DatasourceSpanCE.java index edb8b50fe7e0..d7e447bec50d 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/DatasourceSpanCE.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/DatasourceSpanCE.java @@ -3,7 +3,12 @@ import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX; public class DatasourceSpanCE { + public static final String DATASOURCES = "datasources."; public static final String FETCH_ALL_DATASOURCES_WITH_STORAGES = APPSMITH_SPAN_PREFIX + "get_all_datasource_storage"; public static final String FETCH_ALL_PLUGINS_IN_WORKSPACE = APPSMITH_SPAN_PREFIX + "get_all_plugins_in_workspace"; + + // datasource service spans + public static final String DATASOURCE_SERVICE = "datasourceService"; + public static final String FIND_DATASOURCE_BY_ID = APPSMITH_SPAN_PREFIX + DATASOURCE_SERVICE + ".findById"; } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java index bf56b5bd37fb..5934b6b6ae75 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java @@ -14,6 +14,9 @@ public class PageSpanCE { public static final String PREPARE_APPLICATION_PAGES_DTO_FROM_PAGES = PAGES + "generate_app_pages_dto"; public static final String MIGRATE_DSL = PAGES + "migrate_dsl"; - public static final String GET_PAGE_BY_ID = APPSMITH_SPAN_PREFIX + "get.page.unpublished"; - public static final String GET_PAGE_BY_ID_AND_LAYOUTS_ID = APPSMITH_SPAN_PREFIX + "getPageByIdAndLayoutsId"; + public static final String GET_PAGE_BY_ID = APPSMITH_SPAN_PREFIX + PAGES + "newPageService.findById"; + public static final String GET_PAGE_BY_ID_AND_LAYOUTS_ID = APPSMITH_SPAN_PREFIX + PAGES + "getPageByIdAndLayoutsId"; + + // page level method added here + public static final String IS_NAME_ALLOWED = APPSMITH_SPAN_PREFIX + PAGES + "refactoringService.isNameAllowed"; } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java index 45fe4a882efc..84b1b33e7653 100755 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java @@ -36,7 +36,12 @@ import static com.appsmith.external.constants.spans.ActionSpan.GET_ACTION_BY_ID; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_ACTION_BASED_ON_CONTEXT; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_SINGLE_ACTION; +import static com.appsmith.external.constants.spans.ActionSpan.VALIDATE_AND_GENERATE_ACTION_DOMAIN_BASED_ON_CONTEXT; +import static com.appsmith.external.constants.spans.ActionSpan.VALIDATE_AND_SAVE_ACTION_TO_REPOSITORY; +import static com.appsmith.external.constants.spans.DatasourceSpan.FIND_DATASOURCE_BY_ID; import static com.appsmith.external.constants.spans.LayoutSpan.UPDATE_PAGE_LAYOUT_BY_PAGE_ID; +import static com.appsmith.external.constants.spans.PageSpan.GET_PAGE_BY_ID; +import static com.appsmith.external.constants.spans.PageSpan.IS_NAME_ALLOWED; import static java.util.stream.Collectors.toSet; @Slf4j @@ -337,6 +342,8 @@ protected Mono createAction(ActionDTO actionDTO, Boolean isJsAction) public Mono createAction(ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction) { return validateAndGenerateActionDomainBasedOnContext(actionDTO, isJsAction) + .name(VALIDATE_AND_GENERATE_ACTION_DOMAIN_BASED_ON_CONTEXT) + .tap(Micrometer.observation(observationRegistry)) .flatMap(newAction -> { // If the datasource is embedded, check for workspaceId and set it in action if (actionDTO.getDatasource() != null @@ -361,13 +368,17 @@ public Mono createAction(ActionDTO actionDTO, AppsmithEventContext ev }) .flatMap(savedNewAction -> newActionService .validateAndSaveActionToRepository(savedNewAction) + .name(VALIDATE_AND_SAVE_ACTION_TO_REPOSITORY) + .tap(Micrometer.observation(observationRegistry)) .zipWith(Mono.just(savedNewAction))) .zipWhen(zippedActions -> { ActionDTO savedActionDTO = zippedActions.getT1(); if (savedActionDTO.getDatasource() != null && savedActionDTO.getDatasource().getId() != null) { - return datasourceService.findById( - savedActionDTO.getDatasource().getId()); + return datasourceService + .findById(savedActionDTO.getDatasource().getId()) + .name(FIND_DATASOURCE_BY_ID) + .tap(Micrometer.observation(observationRegistry)); } else { return Mono.justOrEmpty(savedActionDTO.getDatasource()); } @@ -398,6 +409,8 @@ protected Mono validateAndGenerateActionDomainBasedOnContext(ActionDT Mono pageMono = newPageService .findById(action.getPageId(), aclPermission) + .name(GET_PAGE_BY_ID) + .tap(Micrometer.observation(observationRegistry)) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, action.getPageId()))) .cache(); @@ -409,7 +422,10 @@ protected Mono validateAndGenerateActionDomainBasedOnContext(ActionDT String name = action.getValidName(); CreatorContextType contextType = action.getContextType() == null ? CreatorContextType.PAGE : action.getContextType(); - return refactoringService.isNameAllowed(page.getId(), contextType, layout.getId(), name); + return refactoringService + .isNameAllowed(page.getId(), contextType, layout.getId(), name) + .name(IS_NAME_ALLOWED) + .tap(Micrometer.observation(observationRegistry)); }) .flatMap(nameAllowed -> { // If the name is allowed, return pageMono for further processing