Skip to content

Commit 2614dda

Browse files
Monitor document store (#272)
1 parent 7ba8596 commit 2614dda

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

entity-service-factory/src/main/java/org/hypertrace/entity/service/EntityServiceFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.hypertrace.entity.attribute.translator.EntityAttributeMapping;
1818
import org.hypertrace.entity.data.service.EntityDataServiceImpl;
1919
import org.hypertrace.entity.metric.EntityCounterMetricSender;
20+
import org.hypertrace.entity.metric.EntityMetricsReporter;
2021
import org.hypertrace.entity.query.service.EntityQueryServiceImpl;
2122
import org.hypertrace.entity.service.change.event.api.EntityChangeEventGenerator;
2223
import org.hypertrace.entity.service.change.event.impl.EntityChangeEventGeneratorFactory;
@@ -38,6 +39,8 @@ public List<GrpcPlatformService> buildServices(
3839
EntityServiceDataStoreConfig entityServiceDatastoreConfig =
3940
new EntityServiceDataStoreConfig(config);
4041
datastore = DatastoreProvider.getDatastore(entityServiceDatastoreConfig.getDataStoreConfig());
42+
43+
new EntityMetricsReporter(datastore, grpcServiceContainerEnvironment.getLifecycle()).monitor();
4144
grpcServiceContainerEnvironment.getLifecycle().shutdownComplete().thenRun(datastore::close);
4245

4346
EntityAttributeMapping entityAttributeMapping =

entity-service-impl/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies {
1717
implementation("org.hypertrace.core.grpcutils:grpc-client-utils:0.12.6")
1818
implementation("org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.15")
1919
implementation("org.hypertrace.core.serviceframework:platform-metrics:0.1.62")
20+
implementation("org.hypertrace.core.serviceframework:docstore-metrics:0.1.62")
2021
implementation("com.google.inject:guice:5.0.1")
2122

2223
implementation(project(":entity-type-service-rx-client"))
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.hypertrace.entity.metric;
2+
3+
import org.hypertrace.core.documentstore.Datastore;
4+
import org.hypertrace.core.serviceframework.docstore.metrics.DocStoreMetricsRegistry;
5+
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;
6+
7+
public class EntityMetricsReporter {
8+
private final DocStoreMetricsRegistry metricsRegistry;
9+
10+
public EntityMetricsReporter(
11+
final Datastore datastore, final PlatformServiceLifecycle lifecycle) {
12+
metricsRegistry = new DocStoreMetricsRegistry(datastore).withPlatformLifecycle(lifecycle);
13+
}
14+
15+
public void monitor() {
16+
metricsRegistry.monitor();
17+
}
18+
}

0 commit comments

Comments
 (0)