Skip to content

Commit 23dab85

Browse files
fix: update config for new new doc store format (#186)
1 parent d6f6213 commit 23dab85

File tree

18 files changed

+127
-49
lines changed

18 files changed

+127
-49
lines changed

attribute-projection-registry/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ io.grpc:grpc-protobuf:1.57.2=compileClasspath,runtimeClasspath
1919
io.grpc:grpc-stub:1.57.2=compileClasspath,runtimeClasspath
2020
javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath
2121
org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath
22-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
22+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
2323
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath
2424
empty=annotationProcessor

attribute-service-api/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ io.grpc:grpc-protobuf:1.57.2=compileClasspath,runtimeClasspath
1818
io.grpc:grpc-stub:1.57.2=compileClasspath,runtimeClasspath
1919
javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath
2020
org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath
21-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
21+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
2222
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath
2323
empty=annotationProcessor

attribute-service-client/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ io.perfmark:perfmark-api:0.26.0=runtimeClasspath
3131
javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath
3232
org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath
3333
org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath
34-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
34+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
3535
org.hypertrace.core.grpcutils:grpc-client-utils:0.12.5=compileClasspath,runtimeClasspath
3636
org.hypertrace.core.grpcutils:grpc-context-utils:0.12.5=runtimeClasspath
3737
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath

attribute-service-factory/gradle.lockfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ org.eclipse.jetty:jetty-servlet:9.4.52.v20230823=runtimeClasspath
7575
org.eclipse.jetty:jetty-util-ajax:9.4.52.v20230823=runtimeClasspath
7676
org.eclipse.jetty:jetty-util:9.4.52.v20230823=runtimeClasspath
7777
org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath
78-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
78+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
7979
org.hypertrace.core.documentstore:document-store:0.7.37=compileClasspath,runtimeClasspath
8080
org.hypertrace.core.grpcutils:grpc-client-utils:0.12.5=compileClasspath,runtimeClasspath
8181
org.hypertrace.core.grpcutils:grpc-context-utils:0.12.5=runtimeClasspath
8282
org.hypertrace.core.grpcutils:grpc-server-utils:0.12.2=runtimeClasspath
8383
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath
84+
org.hypertrace.core.serviceframework:docstore-metrics:0.1.60=runtimeClasspath
8485
org.hypertrace.core.serviceframework:platform-grpc-service-framework:0.1.60=compileClasspath,runtimeClasspath
8586
org.hypertrace.core.serviceframework:platform-metrics:0.1.60=runtimeClasspath
8687
org.hypertrace.core.serviceframework:platform-service-framework:0.1.60=compileClasspath,runtimeClasspath

attribute-service-factory/src/main/java/org/hypertrace/core/attribute/service/AttributeServiceFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class AttributeServiceFactory implements GrpcPlatformServiceFactory {
1111
@Override
1212
public List<GrpcPlatformService> buildServices(GrpcServiceContainerEnvironment environment) {
1313
return List.of(
14-
new GrpcPlatformService(new AttributeServiceImpl(environment.getConfig(SERVICE_NAME))));
14+
new GrpcPlatformService(
15+
new AttributeServiceImpl(
16+
environment.getConfig(SERVICE_NAME), environment.getLifecycle())));
1517
}
1618
}

attribute-service-impl/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66

77
dependencies {
88
api(projects.attributeServiceApi)
9+
api(commonLibs.hypertrace.framework.spi)
910
implementation(projects.attributeServiceTenantApi)
1011
implementation(commonLibs.hypertrace.documentstore)
1112
implementation(commonLibs.hypertrace.grpcutils.context)
@@ -14,6 +15,7 @@ dependencies {
1415
implementation(commonLibs.slf4j2.api)
1516
implementation(commonLibs.protobuf.javautil)
1617
implementation(commonLibs.guava)
18+
implementation(commonLibs.hypertrace.framework.documentstore.metrics)
1719

1820
testImplementation(commonLibs.mockito.core)
1921
testImplementation(commonLibs.junit.jupiter)

attribute-service-impl/gradle.lockfile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,59 @@ com.google.protobuf:protobuf-java-util:3.24.1=compileClasspath,runtimeClasspath
2222
com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath
2323
com.typesafe:config:1.4.2=compileClasspath,runtimeClasspath
2424
commons-logging:commons-logging:1.2=runtimeClasspath
25+
io.dropwizard.metrics:metrics-core:4.2.16=runtimeClasspath
26+
io.dropwizard.metrics:metrics-jvm:4.2.16=runtimeClasspath
27+
io.github.mweirauch:micrometer-jvm-extras:0.2.2=runtimeClasspath
2528
io.grpc:grpc-api:1.57.2=compileClasspath,runtimeClasspath
2629
io.grpc:grpc-bom:1.57.2=compileClasspath,runtimeClasspath
2730
io.grpc:grpc-context:1.57.2=runtimeClasspath
2831
io.grpc:grpc-core:1.57.2=runtimeClasspath
2932
io.grpc:grpc-protobuf-lite:1.57.2=compileClasspath,runtimeClasspath
3033
io.grpc:grpc-protobuf:1.57.2=compileClasspath,runtimeClasspath
3134
io.grpc:grpc-stub:1.57.2=compileClasspath,runtimeClasspath
35+
io.micrometer:micrometer-commons:1.10.2=runtimeClasspath
36+
io.micrometer:micrometer-core:1.10.2=runtimeClasspath
37+
io.micrometer:micrometer-observation:1.10.2=runtimeClasspath
38+
io.micrometer:micrometer-registry-prometheus:1.10.2=runtimeClasspath
3239
io.perfmark:perfmark-api:0.26.0=runtimeClasspath
40+
io.prometheus:simpleclient:0.16.0=runtimeClasspath
41+
io.prometheus:simpleclient_common:0.16.0=runtimeClasspath
42+
io.prometheus:simpleclient_dropwizard:0.12.0=runtimeClasspath
43+
io.prometheus:simpleclient_pushgateway:0.12.0=runtimeClasspath
44+
io.prometheus:simpleclient_servlet:0.12.0=runtimeClasspath
45+
io.prometheus:simpleclient_servlet_common:0.12.0=runtimeClasspath
46+
io.prometheus:simpleclient_tracer_common:0.16.0=runtimeClasspath
47+
io.prometheus:simpleclient_tracer_otel:0.16.0=runtimeClasspath
48+
io.prometheus:simpleclient_tracer_otel_agent:0.16.0=runtimeClasspath
3349
javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath
50+
javax.servlet:javax.servlet-api:3.1.0=runtimeClasspath
51+
javax.xml.bind:jaxb-api:2.3.0=runtimeClasspath
3452
net.jodah:failsafe:2.4.4=runtimeClasspath
3553
org.apache.commons:commons-collections4:4.4=runtimeClasspath
3654
org.apache.commons:commons-dbcp2:2.9.0=runtimeClasspath
3755
org.apache.commons:commons-lang3:3.12.0=runtimeClasspath
3856
org.apache.commons:commons-pool2:2.10.0=runtimeClasspath
57+
org.apache.logging.log4j:log4j-api:2.19.0=runtimeClasspath
58+
org.apache.logging.log4j:log4j-core:2.19.0=runtimeClasspath
59+
org.apache.logging.log4j:log4j-slf4j-impl:2.19.0=runtimeClasspath
3960
org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath
4061
org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath
41-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
62+
org.eclipse.jetty:jetty-http:9.4.52.v20230823=runtimeClasspath
63+
org.eclipse.jetty:jetty-io:9.4.52.v20230823=runtimeClasspath
64+
org.eclipse.jetty:jetty-security:9.4.52.v20230823=runtimeClasspath
65+
org.eclipse.jetty:jetty-server:9.4.52.v20230823=runtimeClasspath
66+
org.eclipse.jetty:jetty-servlet:9.4.52.v20230823=runtimeClasspath
67+
org.eclipse.jetty:jetty-util-ajax:9.4.52.v20230823=runtimeClasspath
68+
org.eclipse.jetty:jetty-util:9.4.52.v20230823=runtimeClasspath
69+
org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath
70+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
4271
org.hypertrace.core.documentstore:document-store:0.7.37=compileClasspath,runtimeClasspath
4372
org.hypertrace.core.grpcutils:grpc-context-utils:0.12.5=compileClasspath,runtimeClasspath
4473
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath
74+
org.hypertrace.core.serviceframework:docstore-metrics:0.1.60=compileClasspath,runtimeClasspath
75+
org.hypertrace.core.serviceframework:platform-metrics:0.1.60=runtimeClasspath
76+
org.hypertrace.core.serviceframework:service-framework-spi:0.1.60=compileClasspath,runtimeClasspath
77+
org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath
4578
org.mongodb:bson-record-codec:4.9.0=runtimeClasspath
4679
org.mongodb:bson:4.9.0=runtimeClasspath
4780
org.mongodb:mongodb-driver-core:4.9.0=runtimeClasspath

attribute-service-impl/src/main/java/org/hypertrace/core/attribute/service/AttributeServiceImpl.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
import org.hypertrace.core.documentstore.JSONDocument;
5858
import org.hypertrace.core.documentstore.Key;
5959
import org.hypertrace.core.documentstore.Query;
60+
import org.hypertrace.core.documentstore.model.config.DatastoreConfig;
61+
import org.hypertrace.core.documentstore.model.config.TypesafeConfigDatastoreConfigExtractor;
6062
import org.hypertrace.core.grpcutils.context.RequestContext;
63+
import org.hypertrace.core.serviceframework.docstore.metrics.DocStoreMetricsRegistry;
64+
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;
6165
import org.slf4j.Logger;
6266
import org.slf4j.LoggerFactory;
6367

@@ -84,8 +88,8 @@ private static String sourceMetadataPathFor(final AttributeSource source) {
8488
* Initiates with a configuration. The configuration should be production configuration, but for
8589
* V0 The attributes type data would be stored in the configuration
8690
*/
87-
public AttributeServiceImpl(Config config) {
88-
Datastore store = initDataStore(config);
91+
public AttributeServiceImpl(Config config, PlatformServiceLifecycle platformServiceLifecycle) {
92+
Datastore store = initDataStore(config, platformServiceLifecycle);
8993
this.collection = store.getCollection(ATTRIBUTE_METADATA_COLLECTION);
9094
this.validator = new AttributeMetadataValidator(config);
9195
this.converter = new AttributeMetadataConverterImpl();
@@ -99,11 +103,29 @@ public AttributeServiceImpl(Config config) {
99103
this.updater = new AttributeUpdaterImpl(collection);
100104
}
101105

102-
private Datastore initDataStore(Config config) {
103-
Config docStoreConfig = config.getConfig(DOC_STORE_CONFIG_KEY);
104-
String dataStoreType = docStoreConfig.getString(DATA_STORE_TYPE);
105-
Config dataStoreConfig = docStoreConfig.getConfig(dataStoreType);
106-
return DatastoreProvider.getDatastore(dataStoreType, dataStoreConfig);
106+
private Datastore initDataStore(
107+
Config config, PlatformServiceLifecycle platformServiceLifecycle) {
108+
final Config docStoreConfig = config.getConfig(DOC_STORE_CONFIG_KEY);
109+
final String dataStoreType = docStoreConfig.getString(DATA_STORE_TYPE);
110+
final DatastoreConfig datastoreConfig =
111+
TypesafeConfigDatastoreConfigExtractor.from(docStoreConfig, DATA_STORE_TYPE)
112+
.hostKey(dataStoreType + ".host")
113+
.portKey(dataStoreType + ".port")
114+
.keysForEndpoints(dataStoreType + ".endpoints", "host", "port")
115+
.authDatabaseKey(dataStoreType + ".authDb")
116+
.replicaSetKey(dataStoreType + ".replicaSet")
117+
.databaseKey(dataStoreType + ".database")
118+
.usernameKey(dataStoreType + ".user")
119+
.passwordKey(dataStoreType + ".password")
120+
.applicationNameKey("appName")
121+
.extract();
122+
123+
final Datastore datastore = DatastoreProvider.getDatastore(datastoreConfig);
124+
new DocStoreMetricsRegistry(datastore)
125+
.withPlatformLifecycle(platformServiceLifecycle)
126+
.monitor();
127+
128+
return datastore;
107129
}
108130

109131
@Override

attribute-service-tenant-api/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# This file is expected to be part of source control.
44
com.fasterxml.jackson:jackson-bom:2.15.2=compileClasspath,runtimeClasspath
55
io.grpc:grpc-bom:1.57.2=compileClasspath,runtimeClasspath
6-
org.hypertrace.bom:hypertrace-bom:0.2.3=compileClasspath,runtimeClasspath
6+
org.hypertrace.bom:hypertrace-bom:0.2.4=compileClasspath,runtimeClasspath
77
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.3.2=compileClasspath,runtimeClasspath
88
empty=annotationProcessor

attribute-service/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ plugins {
1515
alias(commonLibs.plugins.hypertrace.jacoco)
1616
}
1717

18+
val mongoPort = "37017"
19+
1820
tasks.register<DockerCreateNetwork>("createIntegrationTestNetwork") {
1921
networkName.set("attr-svc-int-test")
2022
}
@@ -33,7 +35,7 @@ tasks.register<DockerCreateContainer>("createMongoContainer") {
3335
targetImageId(tasks.getByName<DockerPullImage>("pullMongoImage").image)
3436
containerName.set("mongo-local")
3537
hostConfig.network.set(tasks.getByName<DockerCreateNetwork>("createIntegrationTestNetwork").networkId)
36-
hostConfig.portBindings.set(listOf("27017:27017"))
38+
hostConfig.portBindings.set(listOf("$mongoPort:27017"))
3739
hostConfig.autoRemove.set(true)
3840
}
3941

@@ -50,6 +52,7 @@ tasks.register<DockerStopContainer>("stopMongoContainer") {
5052
tasks.integrationTest {
5153
useJUnitPlatform()
5254
dependsOn("startMongoContainer")
55+
environment("MONGO_PORT", mongoPort)
5356
finalizedBy("stopMongoContainer")
5457
}
5558

0 commit comments

Comments
 (0)