Class BatchMetrics
java.lang.Object
org.springframework.batch.core.observability.BatchMetrics
Central class for batch metrics. It provides some utility methods like calculating
durations and formatting them in a human-readable format.
Only intended for internal use.
- Since:
- 4.2
- Author:
- Mahmoud Ben Hassine, Glenn Renfro
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable DurationcalculateDuration(@Nullable LocalDateTime startTime, @Nullable LocalDateTime endTime) Calculate the duration between two dates.static StringformatDuration(@Nullable Duration duration) Format a duration in a human readable format like: 2h32m15s10ms.
-
Field Details
-
METRICS_PREFIX
- See Also:
-
STATUS_SUCCESS
- See Also:
-
STATUS_FAILURE
- See Also:
-
STATUS_COMMITTED
- See Also:
-
STATUS_ROLLED_BACK
- See Also:
-
-
Method Details
-
calculateDuration
public static @Nullable Duration calculateDuration(@Nullable LocalDateTime startTime, @Nullable LocalDateTime endTime) Calculate the duration between two dates.- Parameters:
startTime- the start timeendTime- the end time- Returns:
- the duration between start time and end time
-
formatDuration
-