Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sanket-mundra committed Aug 28, 2024
1 parent 0d8e36c commit 4dcc99e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions config-service-factory/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ dependencies {
implementation(projects.notificationRuleConfigServiceImpl)
implementation(projects.notificationChannelConfigServiceImpl)
implementation(projects.spanProcessingConfigServiceImpl)
implementation(commonLibs.hypertrace.framework.documentstore.metrics)
}
2 changes: 1 addition & 1 deletion config-service-factory/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtime
org.hypertrace.core.grpcutils:grpc-server-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.grpcutils:grpc-server-utils:0.13.4=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:docstore-metrics:0.1.76=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:docstore-metrics:0.1.76=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:platform-grpc-service-framework:0.1.76=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:platform-metrics:0.1.76=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:platform-service-framework:0.1.76=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.grpc.Channel;
import io.grpc.health.v1.HealthCheckResponse.ServingStatus;
import java.time.Clock;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -17,6 +18,7 @@
import org.hypertrace.config.service.store.DocumentConfigStore;
import org.hypertrace.core.documentstore.Datastore;
import org.hypertrace.core.documentstore.DatastoreProvider;
import org.hypertrace.core.serviceframework.docstore.metrics.DocStoreCustomMetricReportingConfig;
import org.hypertrace.core.serviceframework.grpc.GrpcPlatformService;
import org.hypertrace.core.serviceframework.grpc.GrpcPlatformServiceFactory;
import org.hypertrace.core.serviceframework.grpc.GrpcServiceContainerEnvironment;
Expand All @@ -43,7 +45,10 @@ public List<GrpcPlatformService> buildServices(
this.grpcServiceContainerEnvironment = grpcServiceContainerEnvironment;
Config config = grpcServiceContainerEnvironment.getConfig(SERVICE_NAME);
return this.buildServices(
this.getLocalChannel(), config, this.buildChangeEventGenerator(config));
this.getLocalChannel(),
config,
this.buildChangeEventGenerator(config),
Collections.emptyList());
}

public void checkAndReportStoreHealth() {
Expand All @@ -61,9 +66,12 @@ public void checkAndReportStoreHealth() {
}

public List<GrpcPlatformService> buildServices(
Channel localChannel, Config config, ConfigChangeEventGenerator configChangeEventGenerator) {
Channel localChannel,
Config config,
ConfigChangeEventGenerator configChangeEventGenerator,
List<DocStoreCustomMetricReportingConfig> configurationCounterConfig) {
return Stream.of(
new ConfigServiceGrpcImpl(this.buildConfigStore(config)),
new ConfigServiceGrpcImpl(this.buildConfigStore(config, configurationCounterConfig)),
new SpacesConfigServiceImpl(localChannel),
new LabelsConfigServiceImpl(localChannel, config, configChangeEventGenerator),
new LabelApplicationRuleConfigServiceImpl(
Expand All @@ -89,10 +97,12 @@ protected ConfigChangeEventGenerator buildChangeEventGenerator(Config config) {
.createConfigChangeEventGenerator(config, Clock.systemUTC());
}

protected ConfigStore buildConfigStore(Config config) {
protected ConfigStore buildConfigStore(
Config config, List<DocStoreCustomMetricReportingConfig> configurationCounterConfig) {
try {
Datastore datastore = initDataStore(config.getConfig(GENERIC_CONFIG_SERVICE_CONFIG));
new ConfigMetricsReporter(datastore, grpcServiceContainerEnvironment.getLifecycle())
new ConfigMetricsReporter(
datastore, grpcServiceContainerEnvironment.getLifecycle(), configurationCounterConfig)
.monitor();
ConfigStore configStore = new DocumentConfigStore(Clock.systemUTC(), datastore);
this.store = configStore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package org.hypertrace.config.service.metric;

import java.util.Collections;
import java.util.List;
import org.hypertrace.core.documentstore.Datastore;
import org.hypertrace.core.serviceframework.docstore.metrics.DocStoreCustomMetricReportingConfig;
import org.hypertrace.core.serviceframework.docstore.metrics.DocStoreMetricsRegistry;
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;

public class ConfigMetricsReporter {
private final DocStoreMetricsRegistry metricsRegistry;

public ConfigMetricsReporter(
final Datastore datastore, final PlatformServiceLifecycle lifecycle) {
final Datastore datastore,
final PlatformServiceLifecycle lifecycle,
List<DocStoreCustomMetricReportingConfig> configurationCounterConfig) {
metricsRegistry =
new DocStoreMetricsRegistry(datastore)
.withPlatformLifecycle(lifecycle)
.withCustomMetrics(Collections.emptyList());
.withCustomMetrics(configurationCounterConfig);
}

public void monitor() {
Expand Down

0 comments on commit 4dcc99e

Please sign in to comment.