diff --git a/hypertrace-core-graphql b/hypertrace-core-graphql index 5a8d6d39..8ef6b667 160000 --- a/hypertrace-core-graphql +++ b/hypertrace-core-graphql @@ -1 +1 @@ -Subproject commit 5a8d6d3928668f5cf76de23d76f6794fb3411e9b +Subproject commit 8ef6b667c33792c4da7a5508d1b6200eaf9ff599 diff --git a/hypertrace-graphql-entity-schema/build.gradle.kts b/hypertrace-graphql-entity-schema/build.gradle.kts index bfd0683b..f9d62183 100644 --- a/hypertrace-graphql-entity-schema/build.gradle.kts +++ b/hypertrace-graphql-entity-schema/build.gradle.kts @@ -29,6 +29,8 @@ dependencies { implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization") implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils") + implementation("org.hypertrace.core.grpcutils:grpc-client-utils") + implementation(project(":hypertrace-graphql-labels-schema-api")) testImplementation("org.junit.jupiter:junit-jupiter") 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 9211674e..0d5b3f93 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 @@ -17,6 +17,7 @@ import org.hypertrace.core.graphql.spi.config.GraphQlServiceConfig; import org.hypertrace.core.graphql.utils.grpc.GrpcChannelRegistry; import org.hypertrace.core.graphql.utils.grpc.GrpcContextBuilder; +import org.hypertrace.core.grpcutils.client.GrpcChannelConfig; import org.hypertrace.gateway.service.GatewayServiceGrpc; import org.hypertrace.gateway.service.GatewayServiceGrpc.GatewayServiceFutureStub; import org.hypertrace.gateway.service.v1.common.Value; @@ -63,10 +64,17 @@ class GatewayServiceEntityDao implements EntityDao { this.serviceConfig = serviceConfig; this.boundedIoScheduler = boundedIoScheduler; + final GrpcChannelConfig grpcChannelConfig = + GrpcChannelConfig.builder() + .maxInboundMessageSize(serviceConfig.getGatewayServiceMaxInboundMessageSize()) + .build(); + this.gatewayServiceStub = GatewayServiceGrpc.newFutureStub( grpcChannelRegistry.forAddress( - serviceConfig.getGatewayServiceHost(), serviceConfig.getGatewayServicePort())) + serviceConfig.getGatewayServiceHost(), + serviceConfig.getGatewayServicePort(), + grpcChannelConfig)) .withCallCredentials(credentials); } diff --git a/hypertrace-graphql-service/src/main/java/org/hypertrace/graphql/service/DefaultGraphQlServiceConfig.java b/hypertrace-graphql-service/src/main/java/org/hypertrace/graphql/service/DefaultGraphQlServiceConfig.java index c9c70286..38a5fada 100644 --- a/hypertrace-graphql-service/src/main/java/org/hypertrace/graphql/service/DefaultGraphQlServiceConfig.java +++ b/hypertrace-graphql-service/src/main/java/org/hypertrace/graphql/service/DefaultGraphQlServiceConfig.java @@ -31,6 +31,8 @@ class DefaultGraphQlServiceConfig implements HypertraceGraphQlServiceConfig { private static final String GATEWAY_SERVICE_HOST_PROPERTY = "gateway.service.host"; private static final String GATEWAY_SERVICE_PORT_PROPERTY = "gateway.service.port"; private static final String GATEWAY_SERVICE_CLIENT_TIMEOUT = "gateway.service.timeout"; + private static final String GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE = + "gateway.service.maxMessageSize.inbound"; private static final String ENTITY_SERVICE_HOST_PROPERTY = "entity.service.host"; private static final String ENTITY_SERVICE_PORT_PROPERTY = "entity.service.port"; @@ -54,6 +56,7 @@ class DefaultGraphQlServiceConfig implements HypertraceGraphQlServiceConfig { String gatewayServiceHost; int gatewayServicePort; Duration gatewayServiceTimeout; + int gatewayServiceMaxInboundMessageSize; String entityServiceHost; int entityServicePort; Duration entityServiceTimeout; @@ -73,25 +76,29 @@ class DefaultGraphQlServiceConfig implements HypertraceGraphQlServiceConfig { this.attributeServiceHost = untypedConfig.getString(ATTRIBUTE_SERVICE_HOST_PROPERTY); this.attributeServicePort = untypedConfig.getInt(ATTRIBUTE_SERVICE_PORT_PROPERTY); + this.attributeServiceTimeout = + getSuppliedDurationOrFallback( + () -> untypedConfig.getDuration(ATTRIBUTE_SERVICE_CLIENT_TIMEOUT)); + this.gatewayServiceHost = untypedConfig.getString(GATEWAY_SERVICE_HOST_PROPERTY); this.gatewayServicePort = untypedConfig.getInt(GATEWAY_SERVICE_PORT_PROPERTY); - this.entityServiceHost = untypedConfig.getString(ENTITY_SERVICE_HOST_PROPERTY); - this.entityServicePort = untypedConfig.getInt(ENTITY_SERVICE_PORT_PROPERTY); - this.configServiceHost = untypedConfig.getString(CONFIG_SERVICE_HOST_PROPERTY); - this.configServicePort = untypedConfig.getInt(CONFIG_SERVICE_PORT_PROPERTY); - this.gatewayServiceTimeout = getSuppliedDurationOrFallback( () -> untypedConfig.getDuration(GATEWAY_SERVICE_CLIENT_TIMEOUT)); - this.attributeServiceTimeout = + this.gatewayServiceMaxInboundMessageSize = + untypedConfig.getBytes(GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE).intValue(); + + this.entityServiceHost = untypedConfig.getString(ENTITY_SERVICE_HOST_PROPERTY); + this.entityServicePort = untypedConfig.getInt(ENTITY_SERVICE_PORT_PROPERTY); + this.entityServiceTimeout = getSuppliedDurationOrFallback( - () -> untypedConfig.getDuration(ATTRIBUTE_SERVICE_CLIENT_TIMEOUT)); + () -> untypedConfig.getDuration(ENTITY_SERVICE_CLIENT_TIMEOUT)); + + this.configServiceHost = untypedConfig.getString(CONFIG_SERVICE_HOST_PROPERTY); + this.configServicePort = untypedConfig.getInt(CONFIG_SERVICE_PORT_PROPERTY); this.configServiceTimeout = getSuppliedDurationOrFallback( () -> untypedConfig.getDuration(CONFIG_SERVICE_CLIENT_TIMEOUT)); - this.entityServiceTimeout = - getSuppliedDurationOrFallback( - () -> untypedConfig.getDuration(ENTITY_SERVICE_CLIENT_TIMEOUT)); } private Duration getSuppliedDurationOrFallback(Supplier durationSupplier) { diff --git a/hypertrace-graphql-service/src/main/resources/configs/common/application.conf b/hypertrace-graphql-service/src/main/resources/configs/common/application.conf index 3248d288..8254ce35 100644 --- a/hypertrace-graphql-service/src/main/resources/configs/common/application.conf +++ b/hypertrace-graphql-service/src/main/resources/configs/common/application.conf @@ -24,6 +24,10 @@ gateway.service = { host = ${?GATEWAY_SERVICE_HOST_CONFIG} port = 50071 port = ${?GATEWAY_SERVICE_PORT_CONFIG} + maxMessageSize = { + inbound = 4MiB + inbound = ${?GATEWAY_SERVICE_MAX_INBOUND_MESSAGE_SIZE_CONFIG} + } } entity.service = {