public final class MethodFaultToleranceMetrics extends Object implements FaultToleranceMetrics
FaultToleranceMetrics.FallbackUsage
DISABLED, NO_TAGS
Constructor and Description |
---|
MethodFaultToleranceMetrics(org.eclipse.microprofile.metrics.MetricRegistry registry,
String canonicalMethodName) |
Modifier and Type | Method and Description |
---|---|
void |
addToHistogram(String metric,
long duration,
org.eclipse.microprofile.metrics.Tag... tags)
Histogram:
|
FaultToleranceMetrics |
boundTo(FaultToleranceMethodContext context,
FaultTolerancePolicy policy)
The first thread calling creates the metrics all thread calling the same method work with.
|
FaultToleranceMetrics.FallbackUsage |
getFallbackUsage() |
void |
incrementCounter(String metric,
org.eclipse.microprofile.metrics.Tag... tags)
Counters:
|
void |
incrementFallbackCallsTotal() |
void |
incrementRetryRetriesTotal()
The number of times the method was retried
|
boolean |
isRetried() |
void |
register(org.eclipse.microprofile.metrics.MetricType type,
String metric,
String[]... tagsPermutations)
Registration:
Registers a metric for each permutation of the tags.
|
void |
register(String metric,
String unit,
LongSupplier gauge,
String... tag)
Gauge registration:
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBulkheadExecutionDuration, addBulkheadWaitingDuration, addTimeoutExecutionDuration, addToHistogram, incrementBulkheadCallsAcceptedTotal, incrementBulkheadCallsRejectedTotal, incrementCircuitbreakerCallsFailedTotal, incrementCircuitbreakerCallsPreventedTotal, incrementCircuitbreakerCallsSucceededTotal, incrementCircuitbreakerOpenedTotal, incrementCounter, incrementInvocationsExceptionThrown, incrementInvocationsValueReturned, incrementRetryCallsExceptionNotRetryable, incrementRetryCallsMaxDurationReached, incrementRetryCallsMaxRetriesReached, incrementRetryCallsValueReturned, incrementTimeoutCallsNotTimedOutTotal, incrementTimeoutCallsTimedOutTotal
public MethodFaultToleranceMetrics(org.eclipse.microprofile.metrics.MetricRegistry registry, String canonicalMethodName)
public FaultToleranceMetrics boundTo(FaultToleranceMethodContext context, FaultTolerancePolicy policy)
registered
is still an AtomicBoolean
so that a state change affects other
MethodFaultToleranceMetrics
instances for the same method that were created in the meantime as well.boundTo
in interface FaultToleranceMetrics
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.public void register(org.eclipse.microprofile.metrics.MetricType type, String metric, String[]... tagsPermutations)
FaultToleranceMetrics
register
in interface FaultToleranceMetrics
type
- MetricType.COUNTER
(assumes no unit) or MetricType.HISTOGRAM
(assumes MetricUnits.NANOSECONDS
)metric
- name of the metric(s)tagsPermutations
- tag name and possible valuespublic void register(String metric, String unit, LongSupplier gauge, String... tag)
FaultToleranceMetrics
register
in interface FaultToleranceMetrics
metric
- name of the gauge metricunit
- unit of the gauge metric (null is MetricUnits.NONE
)gauge
- a supplier function for the gaugetag
- tag name and value if the gauge uses a tagpublic void incrementCounter(String metric, org.eclipse.microprofile.metrics.Tag... tags)
FaultToleranceMetrics
incrementCounter
in interface FaultToleranceMetrics
metric
- full name of the metric with %s
used as placeholder for the method nametags
- all tags to add for the metric except the method
tag (which is added later internally)public void addToHistogram(String metric, long duration, org.eclipse.microprofile.metrics.Tag... tags)
FaultToleranceMetrics
addToHistogram
in interface FaultToleranceMetrics
metric
- full name of the metric with %s
used as placeholder for the method nameduration
- 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)public FaultToleranceMetrics.FallbackUsage getFallbackUsage()
getFallbackUsage
in interface FaultToleranceMetrics
public void incrementFallbackCallsTotal()
incrementFallbackCallsTotal
in interface FaultToleranceMetrics
public void incrementRetryRetriesTotal()
FaultToleranceMetrics
incrementRetryRetriesTotal
in interface FaultToleranceMetrics
public boolean isRetried()
isRetried
in interface FaultToleranceMetrics
FaultToleranceMetrics.incrementRetryRetriesTotal()
has been called at least once, otherwise falseCopyright © 2021. All rights reserved.