Skip to content

Commit

Permalink
feat: apply the gestalt config to the metric recorders.
Browse files Browse the repository at this point in the history
  • Loading branch information
credmond-git committed Apr 4, 2024
1 parent 9215074 commit 421c4b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ private void configurePathMappers() {
pathMappers.forEach(it -> it.applyConfig(gestaltConfig));
}

private void configureMetricsRecorders() {
metricsRecorders.forEach(it -> it.applyConfig(gestaltConfig));
}

/**
* Add a single source to the builder.
*
Expand Down Expand Up @@ -1073,6 +1077,7 @@ public Gestalt build() throws GestaltConfigurationException {
configureConfigLoaders();
configurePostProcessors();
configurePathMappers();
configureMetricsRecorders();

// create a new GestaltCoreReloadStrategy to listen for Gestalt Core Reloads.
CoreReloadListenersContainer coreReloadListenersContainer = new CoreReloadListenersContainer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public <T> MetricsMarker startGetConfig(String path, TypeCapture<T> klass, Tags
}

public void finalizeGetConfig(MetricsMarker markers, Tags tags) {
metricsRecorders.forEach((key, value) -> value.finalizeMetric(markers.getMetricsRecord(key), tags));
if(markers != null) {
metricsRecorders.forEach((key, value) -> value.finalizeMetric(markers.getMetricsRecord(key), tags));
}
}

public MetricsMarker startMetric(String metric, Tags tags) {
Expand All @@ -53,7 +55,9 @@ public MetricsMarker startMetric(String metric, Tags tags) {
}

public void finalizeMetric(MetricsMarker markers, Tags tags) {
metricsRecorders.forEach((key, value) -> value.finalizeMetric(markers.getMetricsRecord(key), tags));
if(markers != null) {
metricsRecorders.forEach((key, value) -> value.finalizeMetric(markers.getMetricsRecord(key), tags));
}
}

/**
Expand Down

0 comments on commit 421c4b3

Please sign in to comment.