Class MetricUtils
java.lang.Object
software.amazon.awssdk.core.internal.util.MetricUtils
Utility methods for working with metrics.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
collectHttpMetrics
(MetricCollector metricCollector, SdkHttpFullResponse httpResponse) static void
collectServiceEndpointMetrics
(MetricCollector metricCollector, SdkHttpFullRequest httpRequest) Collect the SERVICE_ENDPOINT metric for this request.static MetricCollector
static MetricCollector
measureDuration
(Supplier<T> c) Measure the duration of the given callable.Measure the duration of the given callable.static <T> CompletableFuture
<T> reportDuration
(Supplier<CompletableFuture<T>> c, MetricCollector metricCollector, SdkMetric<Duration> metric) Report a duration metric of the givenCompletableFuture
supplier.
-
Method Details
-
measureDuration
Measure the duration of the given callable.- Parameters:
c
- The callable to measure.- Returns:
- A
Pair
containing the result ofc
and the duration.
-
reportDuration
public static <T> CompletableFuture<T> reportDuration(Supplier<CompletableFuture<T>> c, MetricCollector metricCollector, SdkMetric<Duration> metric) Report a duration metric of the givenCompletableFuture
supplier.- Parameters:
c
- The callable to measure.metricCollector
- The MetricCollector where the metric is to be reported.metric
- The metric to be reported.- Returns:
- A
Pair
containing the result ofc
and the duration.
-
measureDurationUnsafe
Measure the duration of the given callable.- Parameters:
c
- The callable to measure.- Returns:
- A
Pair
containing the result ofc
and the duration. - Throws:
Exception
-
collectServiceEndpointMetrics
public static void collectServiceEndpointMetrics(MetricCollector metricCollector, SdkHttpFullRequest httpRequest) Collect the SERVICE_ENDPOINT metric for this request. -
collectHttpMetrics
public static void collectHttpMetrics(MetricCollector metricCollector, SdkHttpFullResponse httpResponse) -
createAttemptMetricsCollector
-
createHttpMetricsCollector
-