Interface FaultToleranceMetrics

  • All Known Implementing Classes:
    MethodFaultToleranceMetrics

    public interface FaultToleranceMetrics
    Encodes the specifics of the FT metrics names using default methods while decoupling rest of the implementation from the MetricRegistry. 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
    • 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 FaultToleranceMetrics that 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) or MetricType.HISTOGRAM (assumes MetricUnits.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 metric
        unit - unit of the gauge metric (null is MetricUnits.NONE)
        gauge - a supplier function for the gauge
        tag - 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 %s used as placeholder for the method name
        tags - all tags to add for the metric except the method tag (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 %s used as placeholder for the method name
        nanos - amount of nanoseconds to add to the histogram (>= 0)
        tags - all tags to add for the metric except the method tag (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.
      • 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
      • 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 with Asynchronous
        Parameters:
        nanos - Nanoseconds
      • incrementFallbackCallsTotal

        default void incrementFallbackCallsTotal()