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 TypeMethodDescriptionvoidCallsbaseline()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 TelemetryLongMetric getInvocations(TelemetryMetricDefinition.InvocationResult result, TelemetryMetricDefinition.InvocationFallback fallbackUsed) -
getRetryCalls
public TelemetryLongMetric getRetryCalls(TelemetryMetricDefinition.RetryRetried retried, TelemetryMetricDefinition.RetryResult result) -
getRetryRetries
-
getTimeoutCalls
-
getTimeoutExecutionDuration
-
getCircuitBreakerCalls
public TelemetryLongMetric getCircuitBreakerCalls(TelemetryMetricDefinition.CircuitBreakerResult cbResult) -
getCircuitBreakerOpened
-
getCircuitBreakerState
public TelemetryLongMetric getCircuitBreakerState(TelemetryMetricDefinition.CircuitBreakerState cbState) -
getBulkheadCalls
public TelemetryLongMetric getBulkheadCalls(TelemetryMetricDefinition.BulkheadResult bulkheadResult) -
getBulkheadExecutionsRunning
-
getBulkheadExecutionsWaiting
-
getBulkheadRunningDuration
-
getBulkheadWaitingDuration
-
baselineMetrics
public void baselineMetrics()Callsbaseline()on all relevant metrics.Extracts all of the metrics which return long values from
TelemetryMetricDefinitionand callsTelemetryLongMetric.baseline()on them.This allows us to check how they've changed later in the test using the
TelemetryLongMetric.delta()method, 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
TelemetryMetricIDs 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
-