Skip to content

Commit 8ef6b66

Browse files
authored
chore(gateway-service): configurable max channel inbound message size (#141)
1 parent 5a8d6d3 commit 8ef6b66

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

hypertrace-core-graphql-service/src/main/java/org/hypertrace/core/graphql/service/DefaultGraphQlServiceConfig.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
2929
private static final String GATEWAY_SERVICE_HOST_PROPERTY = "gateway.service.host";
3030
private static final String GATEWAY_SERVICE_PORT_PROPERTY = "gateway.service.port";
3131
private static final String GATEWAY_SERVICE_CLIENT_TIMEOUT = "gateway.service.timeout";
32+
private static final String GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE =
33+
"gateway.service.maxMessageSize.inbound";
3234

3335
private final String serviceName;
3436
private final int servicePort;
@@ -44,6 +46,7 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
4446
private final String gatewayServiceHost;
4547
private final int gatewayServicePort;
4648
private final Duration gatewayServiceTimeout;
49+
private final int gatewayServiceMaxInboundMessageSize;
4750

4851
DefaultGraphQlServiceConfig(Config untypedConfig) {
4952
this.serviceName = untypedConfig.getString(SERVICE_NAME_CONFIG);
@@ -64,6 +67,8 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
6467
this.gatewayServicePort = untypedConfig.getInt(GATEWAY_SERVICE_PORT_PROPERTY);
6568
this.gatewayServiceTimeout =
6669
getTimeoutOrFallback(() -> untypedConfig.getDuration(GATEWAY_SERVICE_CLIENT_TIMEOUT));
70+
this.gatewayServiceMaxInboundMessageSize =
71+
untypedConfig.getBytes(GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE).intValue();
6772
}
6873

6974
@Override
@@ -136,6 +141,11 @@ public Duration getGatewayServiceTimeout() {
136141
return gatewayServiceTimeout;
137142
}
138143

144+
@Override
145+
public int getGatewayServiceMaxInboundMessageSize() {
146+
return this.gatewayServiceMaxInboundMessageSize;
147+
}
148+
139149
private Duration getTimeoutOrFallback(Supplier<Duration> durationSupplier) {
140150
return optionallyGet(durationSupplier)
141151
.orElse(Duration.ofSeconds(DEFAULT_CLIENT_TIMEOUT_SECONDS));

hypertrace-core-graphql-service/src/main/resources/configs/common/application.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ attribute.service = {
1818
gateway.service = {
1919
host = localhost
2020
port = 50071
21+
maxMessageSize = {
22+
inbound = 4MiB
23+
}
2124
}

hypertrace-core-graphql-spi/src/main/java/org/hypertrace/core/graphql/spi/config/GraphQlServiceConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ public interface GraphQlServiceConfig {
3232
int getGatewayServicePort();
3333

3434
Duration getGatewayServiceTimeout();
35+
36+
int getGatewayServiceMaxInboundMessageSize();
3537
}

0 commit comments

Comments
 (0)