Skip to content

Commit 66ea1e0

Browse files
committed
feat: add state change monitoring for miner parent tenure update, #5918
1 parent 30aaffc commit 66ea1e0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

stacks-signer/src/monitoring/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ SignerAgreementStateChangeReason {
3535
ProtocolUpgrade("protocol_upgrade"),
3636
/// An update related to the Miner view
3737
MinerViewUpdate("miner_view_update"),
38+
/// A specific Miner View update related to the parent tenure
39+
MinerParentTenureUpdate("miner_parent_tenure_update"),
3840
});
3941

4042
define_named_enum!(

stacks-signer/src/v0/signer_state.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,27 @@ impl LocalStateMachine {
833833
crate::monitoring::actions::increment_signer_agreement_state_change_reason(
834834
crate::monitoring::SignerAgreementStateChangeReason::MinerViewUpdate,
835835
);
836+
#[cfg(feature = "monitoring_prom")]
837+
match (&current_miner, &new_miner) {
838+
(
839+
StateMachineUpdateMinerState::ActiveMiner {
840+
parent_tenure_id: current_parent_tenure,
841+
..
842+
},
843+
StateMachineUpdateMinerState::ActiveMiner {
844+
parent_tenure_id: new_parent_tenure,
845+
..
846+
},
847+
) => {
848+
if current_parent_tenure != new_parent_tenure {
849+
crate::monitoring::actions::increment_signer_agreement_state_change_reason(
850+
crate::monitoring::SignerAgreementStateChangeReason::MinerParentTenureUpdate,
851+
);
852+
}
853+
}
854+
_ => {}
855+
}
856+
836857
*self = Self::Initialized(SignerStateMachine {
837858
burn_block,
838859
burn_block_height,

0 commit comments

Comments
 (0)