From e80252387727bdb9e012e24a1700a58c08797618 Mon Sep 17 00:00:00 2001 From: Aaron Steinfeld Date: Thu, 5 Oct 2023 10:03:35 -0400 Subject: [PATCH] refactor: default context --- .../graphql/entity/joiner/DefaultEntityJoinerBuilder.java | 3 +-- .../entity/request/DefaultEntityRequestBuilder.java | 3 --- .../hypertrace/graphql/entity/request/EntityRequest.java | 7 +++++++ .../entity/request/NeighborEntitiesRequestBuilder.java | 2 -- .../label/joiner/DefaultEntityAndRuleJoinerBuilder.java | 3 +-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java index f2f6c718..0a5a2daf 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java @@ -291,7 +291,7 @@ private Single buildEntityRequest( context, entityType, this.entityFieldsByType.get(entityType)), (resultSetRequest, metricRequestList, optionalLabelRequest) -> new DefaultEntityRequest( - context, entityType, resultSetRequest, metricRequestList, optionalLabelRequest)); + entityType, resultSetRequest, metricRequestList, optionalLabelRequest)); } private Single>> buildIdFilter( @@ -304,7 +304,6 @@ private Single>> buildIdFilter( @Value @Accessors(fluent = true) private static class DefaultEntityRequest implements EntityRequest { - GraphQlRequestContext context; String entityType; ResultSetRequest resultSetRequest; List metricRequests; diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java index fa3b823f..788a0725 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java @@ -83,7 +83,6 @@ public Single rebuildWithAdditionalFilters( .map( newResultSetRequest -> new DefaultEntityRequest( - originalRequest.context(), originalRequest.entityType(), newResultSetRequest, originalRequest.metricRequests(), @@ -133,7 +132,6 @@ private Single build( outgoingEdges, optionalLabelsAttributeRequest) -> new DefaultEntityRequest( - context, scope, resultSetRequest, metricRequestList, @@ -178,7 +176,6 @@ private Optional space(Map arguments) { @Value @Accessors(fluent = true) private static class DefaultEntityRequest implements EntityRequest { - GraphQlRequestContext context; String entityType; ResultSetRequest resultSetRequest; List metricRequests; diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java index 27cfd450..3562b1e1 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java @@ -4,10 +4,17 @@ import java.util.Optional; import org.hypertrace.core.graphql.common.request.ContextualRequest; import org.hypertrace.core.graphql.common.request.ResultSetRequest; +import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.graphql.metric.request.MetricRequest; import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; public interface EntityRequest extends ContextualRequest { + + @Override + default GraphQlRequestContext context() { + return resultSetRequest().context(); + } + String entityType(); ResultSetRequest resultSetRequest(); diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/NeighborEntitiesRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/NeighborEntitiesRequestBuilder.java index c43b9ba4..1d888a59 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/NeighborEntitiesRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/NeighborEntitiesRequestBuilder.java @@ -90,7 +90,6 @@ private Single build( context, timeRange, space, this.getOutgoingEdges(neighborFields)), (resultSetRequest, metricRequestList, incomingEdges, outgoingEdges) -> new NeighborEntityRequest( - context, entityScope, resultSetRequest, metricRequestList, @@ -175,7 +174,6 @@ private static class EntityNeighborIdFilter implements FilterArgument { @Value @Accessors(fluent = true) private static class NeighborEntityRequest implements EntityRequest { - GraphQlRequestContext context; String entityType; ResultSetRequest resultSetRequest; List metricRequests; diff --git a/hypertrace-graphql-labels-schema-impl/src/main/java/org/hypertrace/graphql/label/joiner/DefaultEntityAndRuleJoinerBuilder.java b/hypertrace-graphql-labels-schema-impl/src/main/java/org/hypertrace/graphql/label/joiner/DefaultEntityAndRuleJoinerBuilder.java index 77b0088f..a15737a6 100644 --- a/hypertrace-graphql-labels-schema-impl/src/main/java/org/hypertrace/graphql/label/joiner/DefaultEntityAndRuleJoinerBuilder.java +++ b/hypertrace-graphql-labels-schema-impl/src/main/java/org/hypertrace/graphql/label/joiner/DefaultEntityAndRuleJoinerBuilder.java @@ -291,7 +291,7 @@ private Single buildEntityRequest( filterArguments, selectionSet.getFields().stream(), Optional.empty()) - .map(request -> new DefaultEntityRequest(context, entityType, request, fetchTotal)); + .map(request -> new DefaultEntityRequest(entityType, request, fetchTotal)); } private Single>> buildLabelIdFilter( @@ -303,7 +303,6 @@ private Single>> buildLabelIdFilter( @Value @Accessors(fluent = true) private static class DefaultEntityRequest implements EntityRequest { - GraphQlRequestContext context; String entityType; ResultSetRequest resultSetRequest; List metricRequests = Collections.emptyList(); // Only support attributes for now