Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ public class OnLoadSpanCE {
APPSMITH_SPAN_PREFIX + "addExplicitUserSetOnLoadExecutablesToGraph";
public static final String GET_UNPUBLISHED_ON_LOAD_EXECUTABLES_EXPLICIT_SET_BY_USER_IN_CREATOR_CONTEXT =
APPSMITH_SPAN_PREFIX + "getUnpublishedOnLoadExecutablesExplicitSetByUserInCreatorContext";
public static final String GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING =
APPSMITH_SPAN_PREFIX + "getPossibleReferencesFromDynamicBinding";
public static final String AST_SERVICE_CALLING_RTS_API =
APPSMITH_SPAN_PREFIX + "astService.getPossibleReferencesFromDynamicBinding";
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import static com.appsmith.external.constants.spans.OnLoadSpan.GET_ALL_EXECUTABLES_BY_CREATOR_ID;
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.constants.spans.ce.OnLoadSpanCE.GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING;
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;
Expand Down Expand Up @@ -667,8 +668,10 @@ private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityReferences
*/
private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityParentsMap(
List<String> bindings, int types, int evalVersion) {
Flux<Tuple2<String, Set<String>>> findingToReferencesFlux =
astService.getPossibleReferencesFromDynamicBinding(bindings, evalVersion);
Flux<Tuple2<String, Set<String>>> findingToReferencesFlux = astService
.getPossibleReferencesFromDynamicBinding(bindings, evalVersion)
.name(GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING)
.tap(Micrometer.observation(observationRegistry));
return MustacheHelper.getPossibleEntityParentsMap(findingToReferencesFlux, types);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
import com.appsmith.server.configurations.CommonConfig;
import com.appsmith.server.configurations.InstanceConfig;
import com.appsmith.server.services.ce.AstServiceCEImpl;
import io.micrometer.observation.ObservationRegistry;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class AstServiceImpl extends AstServiceCEImpl implements AstService {

public AstServiceImpl(CommonConfig commonConfig, InstanceConfig instanceConfig, RTSCaller rtsCaller) {
super(commonConfig, instanceConfig, rtsCaller);
public AstServiceImpl(
CommonConfig commonConfig,
InstanceConfig instanceConfig,
RTSCaller rtsCaller,
ObservationRegistry observationRegistry) {
super(commonConfig, instanceConfig, rtsCaller, observationRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.exceptions.AppsmithException;
import com.appsmith.util.WebClientUtils;
import io.micrometer.observation.ObservationRegistry;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -17,6 +18,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.observability.micrometer.Micrometer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.resources.ConnectionProvider;
Expand All @@ -34,6 +36,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static com.appsmith.external.constants.spans.ce.OnLoadSpanCE.AST_SERVICE_CALLING_RTS_API;

@Slf4j
@RequiredArgsConstructor
public class AstServiceCEImpl implements AstServiceCE {
Expand All @@ -43,6 +47,7 @@ public class AstServiceCEImpl implements AstServiceCE {
private final InstanceConfig instanceConfig;

private final RTSCaller rtsCaller;
private final ObservationRegistry observationRegistry;

private final WebClient webClient = WebClientUtils.create(ConnectionProvider.builder("rts-provider")
.maxConnections(100)
Expand Down Expand Up @@ -119,6 +124,10 @@ public Flux<Tuple2<String, Set<String>>> getPossibleReferencesFromDynamicBinding
}
return rtsCaller
.post("/rts-api/v1/ast/multiple-script-data", new GetIdentifiersRequestBulk(bindingValues, evalVersion))
.name(AST_SERVICE_CALLING_RTS_API)
.tap(Micrometer.observation(observationRegistry))
.tag("no_of_bindings", String.valueOf(bindingValues.size()))
.tag("eval_version", String.valueOf(evalVersion))
.flatMapMany(spec -> spec.retrieve()
.bodyToMono(GetIdentifiersResponseBulk.class)
.retryWhen(Retry.max(3))
Expand Down