Class TelemetryMetricGetter
The MetricGetter facilitates testing of metrics by providing helper methods for retrieving metrics defined by the faulttolerance spec for a specific class and method name.
This class will never create a metric which does not already exist.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Callsbaseline()
on all relevant metrics.getBulkheadCalls
(TelemetryMetricDefinition.BulkheadResult bulkheadResult) getInvocations
(TelemetryMetricDefinition.InvocationResult result, TelemetryMetricDefinition.InvocationFallback fallbackUsed) getRetryCalls
(TelemetryMetricDefinition.RetryRetried retried, TelemetryMetricDefinition.RetryResult result) static final TelemetryMetricDefinition.AttributeValue[][]
getTagCombinations
(Class<? extends TelemetryMetricDefinition.AttributeValue>... tagValueClazzes) Computes all possible values for a set of tags.
-
Constructor Details
-
TelemetryMetricGetter
-
-
Method Details
-
getInvocations
public TelemetryCounterMetric getInvocations(TelemetryMetricDefinition.InvocationResult result, TelemetryMetricDefinition.InvocationFallback fallbackUsed) -
getRetryCalls
public TelemetryCounterMetric getRetryCalls(TelemetryMetricDefinition.RetryRetried retried, TelemetryMetricDefinition.RetryResult result) -
getRetryRetries
-
getTimeoutCalls
-
getTimeoutExecutionDuration
-
getCircuitBreakerCalls
public TelemetryCounterMetric getCircuitBreakerCalls(TelemetryMetricDefinition.CircuitBreakerResult cbResult) -
getCircuitBreakerOpened
-
getCircuitBreakerState
public TelemetryCounterMetric getCircuitBreakerState(TelemetryMetricDefinition.CircuitBreakerState cbState) -
getBulkheadCalls
public TelemetryCounterMetric getBulkheadCalls(TelemetryMetricDefinition.BulkheadResult bulkheadResult) -
getBulkheadExecutionsRunning
-
getBulkheadExecutionsWaiting
-
getBulkheadRunningDuration
-
getBulkheadWaitingDuration
-
baselineMetrics
public void baselineMetrics()Callsbaseline()
on all relevant metrics.Extracts all of the
Counter
andGauge
metrics fromTelemetryMetricDefinition
and callsTelemetryCounterMetric.baseline()
orTelemetryGaugeMetric.baseline()
on them.This allows us to check how they've changed later in the test using the
CounterMetric.delta()
orGaugeMetric.delta()
methods, without having to explicitly baseline every metric ourselves up front. -
getTagCombinations
@SafeVarargs public static final TelemetryMetricDefinition.AttributeValue[][] getTagCombinations(Class<? extends TelemetryMetricDefinition.AttributeValue>... tagValueClazzes) Computes all possible values for a set of tags.Given an array of TagValue enums, this method find every combination of values from across this set of tags.
For example, if we had two tags
foo=[a|b]
andbar=[x|y]
, this method would return[[foo=a, bar=x], [foo=a, bar=y], [foo=b, bar=x], [foo=b, bar=y]]
We can use this to iterate across all of the
TelemetryMetricID
s which could be created for a metric which has multiple tags.If called with no arguments, this method returns an array containing an empty array (indicating the only possible combination the the one with no tag values at all).
- Parameters:
tagValueClazzes
- the set of tags- Returns:
- every possible combination when taking one value for each of the given tags
-