Interface FaultToleranceMetrics
-
- All Known Implementing Classes:
MethodFaultToleranceMetrics
public interface FaultToleranceMetricsEncodes the specifics of the FT metrics names using default methods while decoupling rest of the implementation from theMetricRegistry. The metrics are bound to a specific invocation context which is not an argument to each of the provided methods but passed to the implementation upon construction. For another invocation another metrics instance is bound.- Author:
- Jan Bernitt
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classFaultToleranceMetrics.FallbackUsage
-
Field Summary
Fields Modifier and Type Field Description static FaultToleranceMetricsDISABLEDCan be used as NULL object when metrics are disabled so avoid testing for enabled but still do essentially NOOPs.static org.eclipse.microprofile.metrics.Tag[]NO_TAGS
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidaddBulkheadExecutionDuration(long nanos)Histogram of the time that method executions spent runningdefault voidaddBulkheadWaitingDuration(long nanos)Histogram of the time that method executions spent waiting in the queue Only added if the method is also annotated withAsynchronousdefault voidaddTimeoutExecutionDuration(long nanos)Histogram of execution times for the methoddefault voidaddToHistogram(String metric, long nanos)default voidaddToHistogram(String metric, long nanos, org.eclipse.microprofile.metrics.Tag... tags)Histogram:default FaultToleranceMetricsboundTo(FaultToleranceMethodContext context, FaultTolerancePolicy policy)default FaultToleranceMetrics.FallbackUsagegetFallbackUsage()default voidincrementBulkheadCallsAcceptedTotal()The number of times the bulkhead logic was run.default voidincrementBulkheadCallsRejectedTotal()The number of times the bulkhead logic was run.default voidincrementCircuitbreakerCallsFailedTotal()The number of times the circuit breaker logic was run.default voidincrementCircuitbreakerCallsPreventedTotal()The number of times the circuit breaker logic was run.default voidincrementCircuitbreakerCallsSucceededTotal()The number of times the circuit breaker logic was run.default voidincrementCircuitbreakerOpenedTotal()Number of times the circuit breaker has moved from closed state to open statedefault voidincrementCounter(String metric)default voidincrementCounter(String metric, org.eclipse.microprofile.metrics.Tag... tags)Counters:default voidincrementFallbackCallsTotal()default voidincrementInvocationsExceptionThrown()The number of times the method was called when an exception was thrown.default voidincrementInvocationsValueReturned()The number of times the method was called when a value was returned.default voidincrementRetryCallsExceptionNotRetryable()The number of times the retry logic was run.default voidincrementRetryCallsMaxDurationReached()The number of times the retry logic was run.default voidincrementRetryCallsMaxRetriesReached()The number of times the retry logic was run.default voidincrementRetryCallsValueReturned()The number of times the retry logic was run.default voidincrementRetryRetriesTotal()The number of times the method was retrieddefault voidincrementTimeoutCallsNotTimedOutTotal()The number of times the timeout logic was run.default voidincrementTimeoutCallsTimedOutTotal()The number of times the timeout logic was run.default booleanisRetried()default voidregister(String metric, String unit, LongSupplier gauge, String... tag)Gauge registration:default voidregister(org.eclipse.microprofile.metrics.MetricType type, String metric, String[]... tags)Registration: Registers a metric for each permutation of the tags.
-
-
-
Field Detail
-
DISABLED
static final FaultToleranceMetrics DISABLED
Can be used as NULL object when metrics are disabled so avoid testing for enabled but still do essentially NOOPs.
-
NO_TAGS
static final org.eclipse.microprofile.metrics.Tag[] NO_TAGS
-
-
Method Detail
-
boundTo
default FaultToleranceMetrics boundTo(FaultToleranceMethodContext context, FaultTolerancePolicy policy)
- Returns:
- a instance on the basis of this
FaultToleranceMetricsthat is properly adopted to the provided context and policy. This can be the same instance if no change is required or a new one if a change of internal state is required. As part of binding to the context and policy this method also should register all metrics that make sense for the provided policy in case this has not been done already.
-
register
default void register(org.eclipse.microprofile.metrics.MetricType type, String metric, String[]... tags)Registration: Registers a metric for each permutation of the tags. Infers unit from type.- Parameters:
type-MetricType.COUNTER(assumes no unit) orMetricType.HISTOGRAM(assumesMetricUnits.NANOSECONDS)metric- name of the metric(s)tags- tag name and possible values
-
register
default void register(String metric, String unit, LongSupplier gauge, String... tag)
Gauge registration:- Parameters:
metric- name of the gauge metricunit- unit of the gauge metric (null isMetricUnits.NONE)gauge- a supplier function for the gaugetag- tag name and value if the gauge uses a tag
-
incrementCounter
default void incrementCounter(String metric, org.eclipse.microprofile.metrics.Tag... tags)
Counters:- Parameters:
metric- full name of the metric with%sused as placeholder for the method nametags- all tags to add for the metric except themethodtag (which is added later internally)
-
incrementCounter
default void incrementCounter(String metric)
-
addToHistogram
default void addToHistogram(String metric, long nanos, org.eclipse.microprofile.metrics.Tag... tags)
Histogram:- Parameters:
metric- full name of the metric with%sused as placeholder for the method namenanos- amount of nanoseconds to add to the histogram (>= 0)tags- all tags to add for the metric except themethodtag (which is added later internally)
-
addToHistogram
default void addToHistogram(String metric, long nanos)
-
incrementInvocationsValueReturned
default void incrementInvocationsValueReturned()
The number of times the method was called when a value was returned.
-
incrementInvocationsExceptionThrown
default void incrementInvocationsExceptionThrown()
The number of times the method was called when an exception was thrown.
-
getFallbackUsage
default FaultToleranceMetrics.FallbackUsage getFallbackUsage()
- Returns:
- How fallback was involved in the current execution of the method
-
incrementRetryCallsValueReturned
default void incrementRetryCallsValueReturned()
The number of times the retry logic was run. This will always be once per method call. When value was returned.
-
incrementRetryCallsExceptionNotRetryable
default void incrementRetryCallsExceptionNotRetryable()
The number of times the retry logic was run. This will always be once per method call. When an exception occurred that does not lead to retries.
-
incrementRetryCallsMaxDurationReached
default void incrementRetryCallsMaxDurationReached()
The number of times the retry logic was run. This will always be once per method call. When maximum total time for retries has been exceeded.
-
incrementRetryCallsMaxRetriesReached
default void incrementRetryCallsMaxRetriesReached()
The number of times the retry logic was run. This will always be once per method call. When maximum number of retries has been reached.
-
incrementRetryRetriesTotal
default void incrementRetryRetriesTotal()
The number of times the method was retried
-
isRetried
default boolean isRetried()
- Returns:
- true if
incrementRetryRetriesTotal()has been called at least once, otherwise false
-
addTimeoutExecutionDuration
default void addTimeoutExecutionDuration(long nanos)
Histogram of execution times for the method- Parameters:
nanos- Nanoseconds
-
incrementTimeoutCallsTimedOutTotal
default void incrementTimeoutCallsTimedOutTotal()
The number of times the timeout logic was run. This will usually be once per method call, but may be zero times if the circuit breaker prevents execution or more than once if the method is retried. When method call timed out
-
incrementTimeoutCallsNotTimedOutTotal
default void incrementTimeoutCallsNotTimedOutTotal()
The number of times the timeout logic was run. This will usually be once per method call, but may be zero times if the circuit breaker prevents execution or more than once if the method is retried. When method call did not time out
-
incrementCircuitbreakerCallsSucceededTotal
default void incrementCircuitbreakerCallsSucceededTotal()
The number of times the circuit breaker logic was run. This will usually be once per method call, but may be more than once if the method call is retried. The method ran and was successful
-
incrementCircuitbreakerCallsFailedTotal
default void incrementCircuitbreakerCallsFailedTotal()
The number of times the circuit breaker logic was run. This will usually be once per method call, but may be more than once if the method call is retried. The method ran and failed
-
incrementCircuitbreakerCallsPreventedTotal
default void incrementCircuitbreakerCallsPreventedTotal()
The number of times the circuit breaker logic was run. This will usually be once per method call, but may be more than once if the method call is retried. The method did not run because the circuit breaker was in open state.
-
incrementCircuitbreakerOpenedTotal
default void incrementCircuitbreakerOpenedTotal()
Number of times the circuit breaker has moved from closed state to open state
-
incrementBulkheadCallsAcceptedTotal
default void incrementBulkheadCallsAcceptedTotal()
The number of times the bulkhead logic was run. This will usually be once per method call, but may be zero times if the circuit breaker prevented execution or more than once if the method call is retried. Bulkhead allowed the method call to run.
-
incrementBulkheadCallsRejectedTotal
default void incrementBulkheadCallsRejectedTotal()
The number of times the bulkhead logic was run. This will usually be once per method call, but may be zero times if the circuit breaker prevented execution or more than once if the method call is retried. Bulkhead did not allow the method call to run.
-
addBulkheadExecutionDuration
default void addBulkheadExecutionDuration(long nanos)
Histogram of the time that method executions spent running- Parameters:
nanos- Nanoseconds
-
addBulkheadWaitingDuration
default void addBulkheadWaitingDuration(long nanos)
Histogram of the time that method executions spent waiting in the queue Only added if the method is also annotated withAsynchronous- Parameters:
nanos- Nanoseconds
-
incrementFallbackCallsTotal
default void incrementFallbackCallsTotal()
-
-