Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ConfigMetricReporter to report metrics around configs #232

Merged
merged 7 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
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=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,16 +6,19 @@
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;
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;
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 @@ -42,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 @@ -60,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 @@ -88,9 +97,13 @@ 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(), configurationCounterConfig)
.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,25 @@
package org.hypertrace.config.service.metric;

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,
List<DocStoreCustomMetricReportingConfig> configurationCounterConfig) {
metricsRegistry =
new DocStoreMetricsRegistry(datastore)
.withPlatformLifecycle(lifecycle)
.withCustomMetrics(configurationCounterConfig);
}

public void monitor() {
metricsRegistry.monitor();
}
}
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
Loading