Skip to content

Commit

Permalink
add ConfigMetricReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
sanket-mundra committed Aug 28, 2024
1 parent e9bad2a commit 2fa3722
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions config-service-factory/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +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: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 @@ -12,6 +12,7 @@
import org.hypertrace.alerting.config.service.EventConditionConfigServiceImpl;
import org.hypertrace.config.service.change.event.api.ConfigChangeEventGenerator;
import org.hypertrace.config.service.change.event.impl.ConfigChangeEventGeneratorFactory;
import org.hypertrace.config.service.metric.ConfigMetricsReporter;
import org.hypertrace.config.service.store.ConfigStore;
import org.hypertrace.config.service.store.DocumentConfigStore;
import org.hypertrace.core.documentstore.Datastore;
Expand Down Expand Up @@ -91,6 +92,8 @@ protected ConfigChangeEventGenerator buildChangeEventGenerator(Config config) {
protected ConfigStore buildConfigStore(Config config) {
try {
Datastore datastore = initDataStore(config.getConfig(GENERIC_CONFIG_SERVICE_CONFIG));
new ConfigMetricsReporter(datastore, grpcServiceContainerEnvironment.getLifecycle())
.monitor();
ConfigStore configStore = new DocumentConfigStore(Clock.systemUTC(), datastore);
this.store = configStore;
return configStore;
Expand Down
1 change: 1 addition & 0 deletions config-service-impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {

implementation(commonLibs.hypertrace.documentstore)
implementation(commonLibs.hypertrace.grpcutils.context)
implementation(commonLibs.hypertrace.framework.documentstore.metrics)

annotationProcessor(commonLibs.lombok)
compileOnly(commonLibs.lombok)
Expand Down
30 changes: 30 additions & 0 deletions config-service-impl/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testC
com.typesafe:config:1.4.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
commons-io:commons-io:2.7=runtimeClasspath,testRuntimeClasspath
commons-logging:commons-logging:1.2=runtimeClasspath,testRuntimeClasspath
io.dropwizard.metrics:metrics-core:4.2.16=runtimeClasspath,testRuntimeClasspath
io.dropwizard.metrics:metrics-jvm:4.2.16=runtimeClasspath,testRuntimeClasspath
io.github.mweirauch:micrometer-jvm-extras:0.2.2=runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.grpc:grpc-context:1.60.0=runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand All @@ -33,9 +36,24 @@ io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileC
io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath
io.micrometer:micrometer-commons:1.10.2=runtimeClasspath,testRuntimeClasspath
io.micrometer:micrometer-core:1.10.2=runtimeClasspath,testRuntimeClasspath
io.micrometer:micrometer-observation:1.10.2=runtimeClasspath,testRuntimeClasspath
io.micrometer:micrometer-registry-prometheus:1.10.2=runtimeClasspath,testRuntimeClasspath
io.netty:netty-bom:4.1.108.Final=testCompileClasspath,testRuntimeClasspath
io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient:0.16.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_common:0.16.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_dropwizard:0.12.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_pushgateway:0.12.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_servlet:0.12.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_servlet_common:0.12.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_tracer_common:0.16.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_tracer_otel:0.16.0=runtimeClasspath,testRuntimeClasspath
io.prometheus:simpleclient_tracer_otel_agent:0.16.0=runtimeClasspath,testRuntimeClasspath
javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
javax.servlet:javax.servlet-api:3.1.0=runtimeClasspath,testRuntimeClasspath
javax.xml.bind:jaxb-api:2.3.0=runtimeClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy-agent:1.14.10=testCompileClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath
net.jodah:failsafe:2.4.4=runtimeClasspath,testRuntimeClasspath
Expand All @@ -47,19 +65,31 @@ org.apache.kafka:kafka-clients:7.5.2-ccs=compileClasspath,runtimeClasspath,testC
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath
org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-http:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-io:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-security:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-server:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-servlet:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-util-ajax:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.eclipse.jetty:jetty-util:9.4.53.v20231009=runtimeClasspath,testRuntimeClasspath
org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath,testRuntimeClasspath
org.hypertrace.bom:hypertrace-bom:0.3.26=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.documentstore:document-store:0.7.65=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.eventstore:event-store:0.1.3=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:docstore-metrics:0.1.76=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:platform-metrics:0.1.76=runtimeClasspath,testRuntimeClasspath
org.hypertrace.core.serviceframework:service-framework-spi:0.1.76=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.10.0=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-engine:5.10.0=testRuntimeClasspath
org.junit.jupiter:junit-jupiter-params:5.10.0=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter:5.10.0=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.10.0=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.10.0=testRuntimeClasspath
org.junit:junit-bom:5.10.0=testCompileClasspath,testRuntimeClasspath
org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath
org.lz4:lz4-java:1.8.0=runtimeClasspath,testRuntimeClasspath
org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath
org.mongodb:bson-record-codec:4.9.0=runtimeClasspath,testRuntimeClasspath
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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) {
metricsRegistry =
new DocStoreMetricsRegistry(datastore)
.withPlatformLifecycle(lifecycle)
.withCustomMetrics(configurationCounterConfig);
}

public void monitor() {
metricsRegistry.monitor();
}

@SuppressWarnings("FieldCanBeLocal")
private final List<DocStoreCustomMetricReportingConfig> configurationCounterConfig =
Collections.emptyList();
}
1 change: 1 addition & 0 deletions config-service/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=runtimeClasspath,testRun
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: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

0 comments on commit 2fa3722

Please sign in to comment.