Updates for new observation classes

This commit is contained in:
spencergibb
2022-10-11 11:45:53 -04:00
parent fc97f88e07
commit e68a8cf2f0
2 changed files with 6 additions and 4 deletions

View File

@@ -19,9 +19,9 @@ package org.springframework.cloud.config.server.environment;
import io.micrometer.common.docs.KeyName;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
import io.micrometer.observation.docs.DocumentedObservation;
import io.micrometer.observation.docs.ObservationDocumentation;
enum DocumentedConfigObservation implements DocumentedObservation {
enum DocumentedConfigObservation implements ObservationDocumentation {
/**
* Observation created around an EnvironmentRepository.

View File

@@ -61,7 +61,8 @@ public final class ObservationEnvironmentRepositoryWrapper implements Environmen
public Environment findOne(String application, String profile, String label) {
ObservationEnvironmentRepositoryContext context = new ObservationEnvironmentRepositoryContext(
this.delegate.getClass(), application, profile, label);
return DocumentedConfigObservation.ENVIRONMENT_REPOSITORY.observation(null, CONVENTION, context, this.registry)
return DocumentedConfigObservation.ENVIRONMENT_REPOSITORY
.observation(null, CONVENTION, () -> context, this.registry)
.observe(() -> this.delegate.findOne(application, profile, label));
}
@@ -69,7 +70,8 @@ public final class ObservationEnvironmentRepositoryWrapper implements Environmen
public Environment findOne(String application, String profile, String label, boolean includeOrigin) {
ObservationEnvironmentRepositoryContext context = new ObservationEnvironmentRepositoryContext(
this.delegate.getClass(), application, profile, label);
return DocumentedConfigObservation.ENVIRONMENT_REPOSITORY.observation(null, CONVENTION, context, this.registry)
return DocumentedConfigObservation.ENVIRONMENT_REPOSITORY
.observation(null, CONVENTION, () -> context, this.registry)
.observe(() -> this.delegate.findOne(application, profile, label, includeOrigin));
}