From 7cd3f8aa07b00ef1b71a4599985f6a82e3eb0074 Mon Sep 17 00:00:00 2001 From: SJ Date: Tue, 1 Aug 2023 23:32:45 +0530 Subject: [PATCH 1/3] chore(gateway-service): configurable max channel inbound message size --- hypertrace-core-graphql | 2 +- hypertrace-graphql-entity-schema/build.gradle.kts | 2 ++ .../graphql/entity/dao/GatewayServiceEntityDao.java | 10 +++++++++- .../graphql/service/DefaultGraphQlServiceConfig.java | 6 ++++++ .../src/main/resources/configs/common/application.conf | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hypertrace-core-graphql b/hypertrace-core-graphql index 984a7e2f..80c02b1a 160000 --- a/hypertrace-core-graphql +++ b/hypertrace-core-graphql @@ -1 +1 @@ -Subproject commit 984a7e2f2947e302ce54f97656aeb8cba00c49e6 +Subproject commit 80c02b1a62320e422628104783d0999edc9d36c2 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..6ee49e5a 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; @@ -92,6 +95,9 @@ class DefaultGraphQlServiceConfig implements HypertraceGraphQlServiceConfig { this.entityServiceTimeout = getSuppliedDurationOrFallback( () -> untypedConfig.getDuration(ENTITY_SERVICE_CLIENT_TIMEOUT)); + + this.gatewayServiceMaxInboundMessageSize = + untypedConfig.getBytes(GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE).intValue(); } 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 = { From e0dbc3d8f6853563d3826eaf055534d01f32b1e8 Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 2 Aug 2023 18:57:22 +0530 Subject: [PATCH 2/3] upgrade submodule --- hypertrace-core-graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypertrace-core-graphql b/hypertrace-core-graphql index 80c02b1a..8ef6b667 160000 --- a/hypertrace-core-graphql +++ b/hypertrace-core-graphql @@ -1 +1 @@ -Subproject commit 80c02b1a62320e422628104783d0999edc9d36c2 +Subproject commit 8ef6b667c33792c4da7a5508d1b6200eaf9ff599 From 8e9a949805a8e9ad2be5c0451f422ae05bda448a Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 2 Aug 2023 19:07:17 +0530 Subject: [PATCH 3/3] club configs --- .../service/DefaultGraphQlServiceConfig.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) 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 6ee49e5a..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 @@ -76,28 +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 = - getSuppliedDurationOrFallback( - () -> untypedConfig.getDuration(ATTRIBUTE_SERVICE_CLIENT_TIMEOUT)); - this.configServiceTimeout = - getSuppliedDurationOrFallback( - () -> untypedConfig.getDuration(CONFIG_SERVICE_CLIENT_TIMEOUT)); + 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(ENTITY_SERVICE_CLIENT_TIMEOUT)); - this.gatewayServiceMaxInboundMessageSize = - untypedConfig.getBytes(GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE).intValue(); + 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)); } private Duration getSuppliedDurationOrFallback(Supplier durationSupplier) {