public class MigrationOpTracker
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
MigrationOpTracker.Checker
Interface for specifying the callback function for the consistency check.
|
Modifier and Type | Method and Description |
---|---|
void |
consistency(MigrationOpTracker.Checker checker)
Check the consistency of a read result.
|
void |
error(MigrationOrigin origin)
Report that an error has occurred for the specified origin.
|
void |
invoked(MigrationOrigin origin)
Call this to report that an origin was invoked (executed).
|
void |
latency(MigrationOrigin origin,
java.time.Duration duration)
Report the latency of an operation.
|
void |
op(MigrationOp op)
Sets the migration related operation associated with these tracking measurements.
|
public void op(@NotNull MigrationOp op)
op
- the operation being trackedpublic void error(@NotNull MigrationOrigin origin)
origin
- the origin of the errorpublic void consistency(@NotNull MigrationOpTracker.Checker checker)
The function will use the checkRatio to determine if the check should be executed, and it will record the result.
If the consistency check function throws an exception, then no measurement for consistency will be included in the generated migration op event.
Example calling the check function from the migration config.
if (checker != null && oldResult.success && newResult.success ) { // Temporary variables for the lambda invocation. MigrationResult@lt;TReadResult@gt; finalNewResult = newResult; MigrationResult@lt;TReadResult@gt; finalOldResult = oldResult; tracker.consistency(() -> checker.check(finalOldResult.result, finalNewResult.result)); }
checker
- The function which executes the check. This is not the `check` function from the
migration options, but instead should be a parameter-less function that calls that function.public void latency(@NotNull MigrationOrigin origin, @NotNull java.time.Duration duration)
origin
- the origin the latency is being reported forduration
- the latency of the operationpublic void invoked(@NotNull MigrationOrigin origin)
origin
- the origin that was invoked