Revert "Adapt observability code to latest changes in Micrometer"
This reverts commit 8973c8a5b6.
This commit is contained in:
@@ -20,15 +20,13 @@ import io.micrometer.observation.Observation;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Observation context for batch jobs.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 5.0
|
||||
*/
|
||||
public class BatchJobContext extends Observation.Context implements Supplier<BatchJobContext> {
|
||||
public class BatchJobContext extends Observation.Context {
|
||||
|
||||
private final JobExecution jobExecution;
|
||||
|
||||
@@ -40,9 +38,4 @@ public class BatchJobContext extends Observation.Context implements Supplier<Bat
|
||||
return jobExecution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchJobContext get() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.batch.core.observability;
|
||||
|
||||
import io.micrometer.common.docs.KeyName;
|
||||
import io.micrometer.observation.docs.ObservationDocumentation;
|
||||
import io.micrometer.observation.docs.DocumentedObservation;
|
||||
|
||||
/**
|
||||
* Observation created around a Job execution.
|
||||
@@ -26,7 +26,7 @@ import io.micrometer.observation.docs.ObservationDocumentation;
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 5.0
|
||||
*/
|
||||
public enum BatchJobObservation implements ObservationDocumentation {
|
||||
public enum BatchJobObservation implements DocumentedObservation {
|
||||
|
||||
BATCH_JOB_OBSERVATION {
|
||||
@Override
|
||||
|
||||
@@ -90,27 +90,11 @@ public final class BatchMetrics {
|
||||
* {@code Metrics.globalRegistry.withTimerObservationHandler()} in the user code.
|
||||
* Otherwise you won't observe any metrics.
|
||||
* @param name of the observation
|
||||
* @param context of the batch job observation
|
||||
* @param context of the observation
|
||||
* @return a new observation instance
|
||||
* @since 5.0
|
||||
*/
|
||||
public static Observation createObservation(String name, BatchJobContext context) {
|
||||
return Observation.createNotStarted(name, context, observationRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Observation}. It's not started, you must explicitly call
|
||||
* {@link Observation#start()} to start it.
|
||||
*
|
||||
* Remember to register the {@link DefaultMeterObservationHandler} via the
|
||||
* {@code Metrics.globalRegistry.withTimerObservationHandler()} in the user code.
|
||||
* Otherwise you won't observe any metrics.
|
||||
* @param name of the observation
|
||||
* @param context of the observation step context
|
||||
* @return a new observation instance
|
||||
* @since 5.0
|
||||
*/
|
||||
public static Observation createObservation(String name, BatchStepContext context) {
|
||||
public static Observation createObservation(String name, Observation.Context context) {
|
||||
return Observation.createNotStarted(name, context, observationRegistry);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,15 +20,13 @@ import io.micrometer.observation.Observation;
|
||||
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Observation context for batch steps.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 5.0
|
||||
*/
|
||||
public class BatchStepContext extends Observation.Context implements Supplier<BatchStepContext> {
|
||||
public class BatchStepContext extends Observation.Context {
|
||||
|
||||
private final StepExecution stepExecution;
|
||||
|
||||
@@ -40,9 +38,4 @@ public class BatchStepContext extends Observation.Context implements Supplier<Ba
|
||||
return stepExecution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchStepContext get() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.batch.core.observability;
|
||||
|
||||
import io.micrometer.common.docs.KeyName;
|
||||
import io.micrometer.observation.docs.ObservationDocumentation;
|
||||
import io.micrometer.observation.docs.DocumentedObservation;
|
||||
|
||||
/**
|
||||
* Observation created around a step execution.
|
||||
@@ -26,7 +26,7 @@ import io.micrometer.observation.docs.ObservationDocumentation;
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 5.0
|
||||
*/
|
||||
public enum BatchStepObservation implements ObservationDocumentation {
|
||||
public enum BatchStepObservation implements DocumentedObservation {
|
||||
|
||||
BATCH_STEP_OBSERVATION {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user