Package io.debezium.relational.history
Class DatabaseHistoryMetrics
java.lang.Object
io.debezium.metrics.Metrics
io.debezium.relational.history.DatabaseHistoryMetrics
- All Implemented Interfaces:
DatabaseHistoryListener
,DatabaseHistoryMXBean
public class DatabaseHistoryMetrics
extends Metrics
implements DatabaseHistoryListener, DatabaseHistoryMXBean
Implementation of
DatabaseSchema
metrics.- Author:
- Jiri Pechanec
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate AtomicLong
private static final String
private HistoryRecord
private Instant
private Instant
private HistoryRecord
private static final org.slf4j.Logger
private static final Duration
private Instant
private AtomicLong
Fields inherited from interface io.debezium.relational.history.DatabaseHistoryListener
NOOP
-
Constructor Summary
ConstructorDescriptionDatabaseHistoryMetrics
(CommonConnectorConfig connectorConfig, boolean multiPartitionMode) -
Method Summary
Modifier and TypeMethodDescriptionlong
long
long
long
long
The database history starts inSTOPPED
state.void
onChangeApplied
(HistoryRecord record) Invoked for every change applied and not filtered.void
onChangeFromHistory
(HistoryRecord record) Invoked for every change read from the history during recovery.void
void
void
started()
void
stopped()
Methods inherited from class io.debezium.metrics.Metrics
metricName, metricName, register, unregister
-
Field Details
-
CONTEXT_NAME
- See Also:
-
PAUSE_BETWEEN_LOG_MESSAGES
-
LOGGER
private static final org.slf4j.Logger LOGGER -
status
-
recoveryStartTime
-
changesRecovered
-
totalChangesApplied
-
lastChangeAppliedTimestamp
-
lastChangeRecoveredTimestamp
-
lastAppliedChange
-
lastRecoveredChange
-
-
Constructor Details
-
DatabaseHistoryMetrics
-
-
Method Details
-
getStatus
Description copied from interface:DatabaseHistoryMXBean
The database history starts inSTOPPED
state. Upon start it transitions toRECOVERING
state. When all changes from stored history were applied then it switches toRUNNING
state.Maps to
DatabaseHistoryMetrics.DatabaseHistoryStatus
enum.- Specified by:
getStatus
in interfaceDatabaseHistoryMXBean
- Returns:
- database history component state
-
getRecoveryStartTime
public long getRecoveryStartTime()- Specified by:
getRecoveryStartTime
in interfaceDatabaseHistoryMXBean
- Returns:
- time in epoch seconds when recovery has started
-
getChangesRecovered
public long getChangesRecovered()- Specified by:
getChangesRecovered
in interfaceDatabaseHistoryMXBean
- Returns:
- number of changes that were read during recovery phase
-
getChangesApplied
public long getChangesApplied()- Specified by:
getChangesApplied
in interfaceDatabaseHistoryMXBean
- Returns:
- number of changes that were applied during recovery phase increased by number of changes applied during runtime
-
getMilliSecondsSinceLastAppliedChange
public long getMilliSecondsSinceLastAppliedChange()- Specified by:
getMilliSecondsSinceLastAppliedChange
in interfaceDatabaseHistoryMXBean
- Returns:
- elapsed time in milliseconds since the last change was applied
-
getMilliSecondsSinceLastRecoveredChange
public long getMilliSecondsSinceLastRecoveredChange()- Specified by:
getMilliSecondsSinceLastRecoveredChange
in interfaceDatabaseHistoryMXBean
- Returns:
- elapsed time in milliseconds since the last record was recovered from history
-
getLastAppliedChange
- Specified by:
getLastAppliedChange
in interfaceDatabaseHistoryMXBean
- Returns:
- String representation of the last applied change
-
getLastRecoveredChange
- Specified by:
getLastRecoveredChange
in interfaceDatabaseHistoryMXBean
- Returns:
- String representation of the last recovered change
-
started
public void started()- Specified by:
started
in interfaceDatabaseHistoryListener
-
stopped
public void stopped()- Specified by:
stopped
in interfaceDatabaseHistoryListener
-
recoveryStarted
public void recoveryStarted()- Specified by:
recoveryStarted
in interfaceDatabaseHistoryListener
-
recoveryStopped
public void recoveryStopped()- Specified by:
recoveryStopped
in interfaceDatabaseHistoryListener
-
onChangeFromHistory
Description copied from interface:DatabaseHistoryListener
Invoked for every change read from the history during recovery.- Specified by:
onChangeFromHistory
in interfaceDatabaseHistoryListener
-
onChangeApplied
Description copied from interface:DatabaseHistoryListener
Invoked for every change applied and not filtered.- Specified by:
onChangeApplied
in interfaceDatabaseHistoryListener
-