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
2 changes: 1 addition & 1 deletion hypertrace-core-graphql
Submodule hypertrace-core-graphql updated 19 files
+1 −0 hypertrace-core-graphql-impl/build.gradle.kts
+2 −0 hypertrace-core-graphql-impl/src/main/java/org/hypertrace/core/graphql/impl/GraphQlModule.java
+19 −0 hypertrace-core-graphql-request-transformation/build.gradle.kts
+20 −0 ...-transformation/src/main/java/org/hypertrace/core/graphql/request/transformation/RequestTransformation.java
+13 −0 ...formation/src/main/java/org/hypertrace/core/graphql/request/transformation/RequestTransformationModule.java
+12 −0 ...est-transformation/src/main/java/org/hypertrace/core/graphql/request/transformation/RequestTransformer.java
+27 −0 ...transformation/src/main/java/org/hypertrace/core/graphql/request/transformation/RequestTransformerImpl.java
+85 −0 ...sformation/src/test/java/org/hypertrace/core/graphql/request/transformation/RequestTransformerImplTest.java
+1 −0 hypertrace-core-graphql-span-schema/build.gradle.kts
+8 −3 ...race-core-graphql-span-schema/src/main/java/org/hypertrace/core/graphql/span/dao/GatewayServiceSpanDao.java
+2 −0 hypertrace-core-graphql-span-schema/src/main/java/org/hypertrace/core/graphql/span/dao/SpanDaoModule.java
+3 −2 ...e-graphql-span-schema/src/main/java/org/hypertrace/core/graphql/span/request/DefaultSpanRequestBuilder.java
+2 −1 hypertrace-core-graphql-span-schema/src/main/java/org/hypertrace/core/graphql/span/request/SpanRequest.java
+1 −1 hypertrace-core-graphql-span-schema/src/test/java/org/hypertrace/core/graphql/span/dao/DaoTestUtil.java
+2 −2 ...-graphql-span-schema/src/test/java/org/hypertrace/core/graphql/span/dao/SpanLogEventRequestBuilderTest.java
+1 −0 hypertrace-core-graphql-trace-schema/build.gradle.kts
+8 −3 ...e-core-graphql-trace-schema/src/main/java/org/hypertrace/core/graphql/trace/dao/GatewayServiceTraceDao.java
+2 −0 hypertrace-core-graphql-trace-schema/src/main/java/org/hypertrace/core/graphql/trace/dao/TraceDaoModule.java
+2 −1 settings.gradle.kts
1 change: 1 addition & 0 deletions hypertrace-graphql-explorer-schema/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-utils")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-request-transformation")

testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.hypertrace.core.graphql.common.schema.attributes.MetricAggregationType;
import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument;
import org.hypertrace.core.graphql.common.utils.Converter;
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;
Expand All @@ -41,6 +42,7 @@ protected void configure() {
requireBinding(Key.get(Scheduler.class, BoundedIoScheduler.class));
requireBinding(Key.get(new TypeLiteral<Converter<Value, Object>>() {}));
requireBinding(Key.get(new TypeLiteral<Converter<AttributeModelType, AttributeType>>() {}));
requireBinding(RequestTransformer.class);
requireBinding(
Key.get(
new TypeLiteral<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javax.inject.Inject;
import javax.inject.Singleton;
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;
Expand All @@ -26,6 +27,7 @@ class GatewayServiceExplorerDao implements ExplorerDao {
private final GatewayServiceExploreResponseConverter responseConverter;
private final GraphQlServiceConfig serviceConfig;
private final Scheduler boundedIoScheduler;
private final RequestTransformer requestTransformer;

@Inject
GatewayServiceExplorerDao(
Expand All @@ -35,12 +37,14 @@ class GatewayServiceExplorerDao implements ExplorerDao {
GrpcChannelRegistry grpcChannelRegistry,
GatewayServiceExploreRequestBuilder requestBuilder,
GatewayServiceExploreResponseConverter responseConverter,
@BoundedIoScheduler Scheduler boundedIoScheduler) {
@BoundedIoScheduler Scheduler boundedIoScheduler,
RequestTransformer requestTransformer) {
this.grpcContextBuilder = grpcContextBuilder;
this.requestBuilder = requestBuilder;
this.responseConverter = responseConverter;
this.serviceConfig = serviceConfig;
this.boundedIoScheduler = boundedIoScheduler;
this.requestTransformer = requestTransformer;

this.gatewayServiceStub =
GatewayServiceGrpc.newFutureStub(
Expand All @@ -51,10 +55,11 @@ class GatewayServiceExplorerDao implements ExplorerDao {

@Override
public Single<ExploreResultSet> explore(ExploreRequest request) {
return this.requestBuilder
.buildRequest(request)
return this.requestTransformer
.transform(request)
.flatMap(this.requestBuilder::buildRequest)
.subscribeOn(this.boundedIoScheduler)
.flatMap(serverRequest -> this.makeRequest(request.requestContext(), serverRequest))
.flatMap(serverRequest -> this.makeRequest(request.context(), serverRequest))
.flatMap(serverResponse -> this.responseConverter.convert(request, serverResponse));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private Single<Set<AttributeRequest>> buildGroupByAttributes(
@Value
@Accessors(fluent = true)
private static class DefaultExploreRequest implements ExploreRequest {
GraphQlRequestContext requestContext;
GraphQlRequestContext context;
String scope;
TimeRangeArgument timeRange;
int limit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import java.util.Set;
import org.hypertrace.core.graphql.common.request.AttributeAssociation;
import org.hypertrace.core.graphql.common.request.AttributeRequest;
import org.hypertrace.core.graphql.common.request.ContextualRequest;
import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument;
import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument;
import org.hypertrace.core.graphql.context.GraphQlRequestContext;
import org.hypertrace.graphql.explorer.schema.argument.IntervalArgument;
import org.hypertrace.graphql.metric.request.MetricAggregationRequest;

public interface ExploreRequest {
GraphQlRequestContext requestContext();

public interface ExploreRequest extends ContextualRequest {
String scope();

TimeRangeArgument timeRange();
Expand Down
1 change: 1 addition & 0 deletions hypertrace-graphql-impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-span-schema")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-log-event-schema")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-trace-schema")
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-request-transformation")
implementation(project(":hypertrace-graphql-entity-schema"))
implementation(project(":hypertrace-graphql-explorer-schema"))
implementation(project(":hypertrace-graphql-explorer-context"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.hypertrace.core.graphql.deserialization.GraphQlDeserializationRegistryModule;
import org.hypertrace.core.graphql.log.event.LogEventSchemaModule;
import org.hypertrace.core.graphql.metadata.MetadataSchemaModule;
import org.hypertrace.core.graphql.request.transformation.RequestTransformationModule;
import org.hypertrace.core.graphql.rx.RxUtilModule;
import org.hypertrace.core.graphql.schema.registry.GraphQlSchemaRegistryModule;
import org.hypertrace.core.graphql.span.SpanSchemaModule;
Expand Down Expand Up @@ -69,5 +70,6 @@ protected void configure() {
install(new RxUtilModule());
install(new EntityIdModule());
install(new SpacesSchemaModule());
install(new RequestTransformationModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static class ActiveSpaceExploreRequest implements ExploreRequest {
private static final String SPACE_IDS_SCOPE = "EVENT";
private static final int MAX_SPACES = 100;

GraphQlRequestContext requestContext;
GraphQlRequestContext context;
String scope = SPACE_IDS_SCOPE;
int limit = MAX_SPACES;
int offset = 0;
Expand All @@ -161,7 +161,7 @@ private static class ActiveSpaceExploreRequest implements ExploreRequest {
TimeRangeArgument timeRange,
AttributeRequest spaceIdRequest,
MetricAggregationRequest spaceIdCountRequest) {
this.requestContext = context;
this.context = context;
this.timeRange = timeRange;
// Aggregation needed to pass explorer validation - a no agg request is not valid
this.aggregationRequests = Set.of(spaceIdCountRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void makesAppropriateRequest() {
.explore(
argThat(
request ->
request.requestContext().equals(this.mockContext)
request.context().equals(this.mockContext)
&& request.scope().equals("EVENT")
&& request.limit() == 100
&& request.offset() == 0
Expand Down