From a02e74f19acd52283b86b1d92703ac7caaf2f01d Mon Sep 17 00:00:00 2001 From: SJ <48863181+skjindal93@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:14:37 +0530 Subject: [PATCH] fix(entities): support for API filters for filtered data specs (#232) * fix(entities): support for API filters for filtered data specs * nit: remove extra line --- hypertrace-graphql-entity-schema/build.gradle.kts | 1 + .../graphql/entity/dao/GatewayServiceEntityDao.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hypertrace-graphql-entity-schema/build.gradle.kts b/hypertrace-graphql-entity-schema/build.gradle.kts index 7a429bb2..a330fca7 100644 --- a/hypertrace-graphql-entity-schema/build.gradle.kts +++ b/hypertrace-graphql-entity-schema/build.gradle.kts @@ -24,6 +24,7 @@ dependencies { implementation(commonLibs.hypertrace.grpcutils.client) implementation(projects.hypertraceGraphqlLabelsSchemaApi) + implementation(localLibs.core.request.transformation) implementation(localLibs.core.context) implementation(localLibs.core.grpc) implementation(localLibs.core.schema.utils) diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java index 0d5b3f93..2088ee53 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java @@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j; import org.hypertrace.core.graphql.common.request.AttributeRequest; import org.hypertrace.core.graphql.context.GraphQlRequestContext; +import org.hypertrace.core.graphql.request.transformation.RequestTransformer; import org.hypertrace.core.graphql.rx.BoundedIoScheduler; import org.hypertrace.core.graphql.spi.config.GraphQlServiceConfig; import org.hypertrace.core.graphql.utils.grpc.GrpcChannelRegistry; @@ -44,6 +45,7 @@ class GatewayServiceEntityDao implements EntityDao { private final GraphQlServiceConfig serviceConfig; private final Scheduler boundedIoScheduler; private final LabelJoinerBuilder labelJoinerBuilder; + private final RequestTransformer requestTransformer; @Inject GatewayServiceEntityDao( @@ -55,6 +57,7 @@ class GatewayServiceEntityDao implements EntityDao { GatewayServiceEntityConverter entityConverter, BaselineDao baselineDao, LabelJoinerBuilder labelJoinerBuilder, + RequestTransformer requestTransformer, @BoundedIoScheduler Scheduler boundedIoScheduler) { this.grpcContextBuilder = grpcContextBuilder; this.requestBuilder = requestBuilder; @@ -62,6 +65,7 @@ class GatewayServiceEntityDao implements EntityDao { this.baselineDao = baselineDao; this.labelJoinerBuilder = labelJoinerBuilder; this.serviceConfig = serviceConfig; + this.requestTransformer = requestTransformer; this.boundedIoScheduler = boundedIoScheduler; final GrpcChannelConfig grpcChannelConfig = @@ -81,8 +85,9 @@ class GatewayServiceEntityDao implements EntityDao { @Override public Single getEntities(EntityRequest request) { GraphQlRequestContext context = request.resultSetRequest().context(); - return this.requestBuilder - .buildRequest(request) + return this.requestTransformer + .transform(request) + .flatMap(this.requestBuilder::buildRequest) .subscribeOn(this.boundedIoScheduler) .flatMap(serverRequest -> this.fetchAndMapEntities(context, request, serverRequest)); }