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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicLongprivate static final Stringprivate HistoryRecordprivate Instantprivate Instantprivate HistoryRecordprivate static final org.slf4j.Loggerprivate static final Durationprivate Instantprivate AtomicLongFields inherited from interface io.debezium.relational.history.DatabaseHistoryListener
NOOP -
Constructor Summary
ConstructorsConstructorDescriptionDatabaseHistoryMetrics(CommonConnectorConfig connectorConfig, boolean multiPartitionMode) -
Method Summary
Modifier and TypeMethodDescriptionlonglonglonglonglongThe database history starts inSTOPPEDstate.voidonChangeApplied(HistoryRecord record) Invoked for every change applied and not filtered.voidonChangeFromHistory(HistoryRecord record) Invoked for every change read from the history during recovery.voidvoidvoidstarted()voidstopped()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:DatabaseHistoryMXBeanThe database history starts inSTOPPEDstate. Upon start it transitions toRECOVERINGstate. When all changes from stored history were applied then it switches toRUNNINGstate.Maps to
DatabaseHistoryMetrics.DatabaseHistoryStatusenum.- Specified by:
getStatusin interfaceDatabaseHistoryMXBean- Returns:
- database history component state
-
getRecoveryStartTime
public long getRecoveryStartTime()- Specified by:
getRecoveryStartTimein interfaceDatabaseHistoryMXBean- Returns:
- time in epoch seconds when recovery has started
-
getChangesRecovered
public long getChangesRecovered()- Specified by:
getChangesRecoveredin interfaceDatabaseHistoryMXBean- Returns:
- number of changes that were read during recovery phase
-
getChangesApplied
public long getChangesApplied()- Specified by:
getChangesAppliedin 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:
getMilliSecondsSinceLastAppliedChangein interfaceDatabaseHistoryMXBean- Returns:
- elapsed time in milliseconds since the last change was applied
-
getMilliSecondsSinceLastRecoveredChange
public long getMilliSecondsSinceLastRecoveredChange()- Specified by:
getMilliSecondsSinceLastRecoveredChangein interfaceDatabaseHistoryMXBean- Returns:
- elapsed time in milliseconds since the last record was recovered from history
-
getLastAppliedChange
- Specified by:
getLastAppliedChangein interfaceDatabaseHistoryMXBean- Returns:
- String representation of the last applied change
-
getLastRecoveredChange
- Specified by:
getLastRecoveredChangein interfaceDatabaseHistoryMXBean- Returns:
- String representation of the last recovered change
-
started
public void started()- Specified by:
startedin interfaceDatabaseHistoryListener
-
stopped
public void stopped()- Specified by:
stoppedin interfaceDatabaseHistoryListener
-
recoveryStarted
public void recoveryStarted()- Specified by:
recoveryStartedin interfaceDatabaseHistoryListener
-
recoveryStopped
public void recoveryStopped()- Specified by:
recoveryStoppedin interfaceDatabaseHistoryListener
-
onChangeFromHistory
Description copied from interface:DatabaseHistoryListenerInvoked for every change read from the history during recovery.- Specified by:
onChangeFromHistoryin interfaceDatabaseHistoryListener
-
onChangeApplied
Description copied from interface:DatabaseHistoryListenerInvoked for every change applied and not filtered.- Specified by:
onChangeAppliedin interfaceDatabaseHistoryListener
-