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: 2 additions & 0 deletions hypertrace-graphql-entity-schema/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -54,6 +56,7 @@ class DefaultGraphQlServiceConfig implements HypertraceGraphQlServiceConfig {
String gatewayServiceHost;
int gatewayServicePort;
Duration gatewayServiceTimeout;
int gatewayServiceMaxInboundMessageSize;
String entityServiceHost;
int entityServicePort;
Duration entityServiceTimeout;
Expand All @@ -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<Duration> durationSupplier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down