Skip to content

Commit d30509b

Browse files
refactor: use container provided channel registry (#153)
* refactor: use container provided channel registry * refactor: submodule to main
1 parent 3b65dfb commit d30509b

File tree

8 files changed

+26
-10
lines changed

8 files changed

+26
-10
lines changed

.github/workflows/pr-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ jobs:
5353
if: always()
5454

5555
- name: Publish Unit Test Results
56-
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6
56+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v2
5757
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
5858
with:
5959
github_token: ${{ secrets.GITHUB_TOKEN }}
60-
files: ./**/build/test-results/**/*.xml
60+
junit_files: ./**/build/test-results/**/*.xml

.snyk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ ignore:
55
SNYK-JAVA-IONETTY-1042268:
66
- '*':
77
reason: No replacement available
8-
expires: 2022-07-31T00:00:00.000Z
8+
expires: 2022-10-31T00:00:00.000Z
99
patch: {}
1010

hypertrace-graphql-impl/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies {
88
api("org.hypertrace.core.graphql:hypertrace-core-graphql-spi")
99
api("com.graphql-java-kickstart:graphql-java-servlet")
1010
api(project(":hypertrace-graphql-service-config"))
11+
api("org.hypertrace.core.grpcutils:grpc-client-utils")
1112

1213
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-registry")
1314
implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-context")

hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
import graphql.schema.GraphQLSchema;
77
import org.hypertrace.core.graphql.context.GraphQlRequestContextBuilder;
88
import org.hypertrace.core.graphql.spi.lifecycle.GraphQlServiceLifecycle;
9+
import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry;
910
import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig;
1011

1112
public class GraphQlFactory {
1213
public static GraphQLConfiguration build(
13-
HypertraceGraphQlServiceConfig config, GraphQlServiceLifecycle serviceLifecycle) {
14-
final Injector injector = Guice.createInjector(new GraphQlModule(config, serviceLifecycle));
14+
HypertraceGraphQlServiceConfig config,
15+
GraphQlServiceLifecycle serviceLifecycle,
16+
GrpcChannelRegistry grpcChannelRegistry) {
17+
final Injector injector =
18+
Guice.createInjector(new GraphQlModule(config, serviceLifecycle, grpcChannelRegistry));
1519

1620
return GraphQLConfiguration.with(injector.getInstance(GraphQLSchema.class))
1721
.with(injector.getInstance(GraphQlRequestContextBuilder.class))

hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlModule.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.hypertrace.core.graphql.utils.gateway.GatewayUtilsModule;
2020
import org.hypertrace.core.graphql.utils.grpc.GraphQlGrpcModule;
2121
import org.hypertrace.core.graphql.utils.schema.SchemaUtilsModule;
22+
import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry;
2223
import org.hypertrace.graphql.atttribute.scopes.HypertraceAttributeScopeModule;
2324
import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig;
2425
import org.hypertrace.graphql.entity.EntityIdModule;
@@ -37,10 +38,15 @@ class GraphQlModule extends AbstractModule {
3738
private final HypertraceGraphQlServiceConfig config;
3839
private final GraphQlServiceLifecycle serviceLifecycle;
3940

41+
private final GrpcChannelRegistry grpcChannelRegistry;
42+
4043
public GraphQlModule(
41-
final HypertraceGraphQlServiceConfig config, final GraphQlServiceLifecycle serviceLifecycle) {
44+
final HypertraceGraphQlServiceConfig config,
45+
final GraphQlServiceLifecycle serviceLifecycle,
46+
final GrpcChannelRegistry grpcChannelRegistry) {
4247
this.config = config;
4348
this.serviceLifecycle = serviceLifecycle;
49+
this.grpcChannelRegistry = grpcChannelRegistry;
4450
}
4551

4652
@Override
@@ -50,7 +56,7 @@ protected void configure() {
5056
bind(GraphQlServiceLifecycle.class).toInstance(this.serviceLifecycle);
5157
bind(Clock.class).toInstance(Clock.systemUTC());
5258
install(new GraphQlRequestContextModule());
53-
install(new GraphQlGrpcModule());
59+
install(new GraphQlGrpcModule(this.grpcChannelRegistry));
5460
install(new GraphQlSchemaRegistryModule());
5561
install(new GraphQlDeserializationRegistryModule());
5662
install(new HypertraceAttributeScopeModule());

hypertrace-graphql-impl/src/test/java/org/hypertrace/graphql/impl/GraphQlModuleTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.google.inject.Guice;
77
import org.hypertrace.core.graphql.spi.lifecycle.GraphQlServiceLifecycle;
8+
import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry;
89
import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig;
910
import org.junit.jupiter.api.Test;
1011

@@ -17,7 +18,8 @@ public void testResolveBindings() {
1718
Guice.createInjector(
1819
new GraphQlModule(
1920
mock(HypertraceGraphQlServiceConfig.class),
20-
mock(GraphQlServiceLifecycle.class)))
21+
mock(GraphQlServiceLifecycle.class),
22+
mock(GrpcChannelRegistry.class)))
2123
.getAllBindings());
2224
}
2325
}

hypertrace-graphql-service/src/main/java/org/hypertrace/graphql/service/GraphQlServiceFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public List<HttpHandlerDefinition> buildHandlers(HttpContainerEnvironment enviro
2525
.port(config.getServicePort())
2626
.contextPath(config.getGraphQlUrlPath())
2727
.corsConfig(buildCorsConfig(config))
28-
.servlet(new GraphQlServiceHttpServlet(GraphQlFactory.build(config, serviceLifecycle)))
28+
.servlet(
29+
new GraphQlServiceHttpServlet(
30+
GraphQlFactory.build(
31+
config, serviceLifecycle, environment.getChannelRegistry())))
2932
.build());
3033
}
3134

0 commit comments

Comments
 (0)