def create_staking_events_metric_collectors( ursula: 'Ursula', metrics_prefix: str) -> List[MetricsCollector]: """Create collectors for staking-related events.""" collectors: List[MetricsCollector] = [] staking_agent = ContractAgency.get_agent(StakingEscrowAgent, registry=ursula.registry) staker_address = ursula.checksum_address # CommitmentMade collectors.append( CommitmentMadeEventMetricsCollector(event_args_config={ "value": (Gauge, f'{metrics_prefix}_activity_confirmed_value', 'CommitmentMade to next period with value of locked tokens'), "period": (Gauge, f'{metrics_prefix}_activity_confirmed_period', 'Commitment made for period') }, staker_address=staker_address, contract_agent=staking_agent)) # Minted collectors.append( EventMetricsCollector( event_name='Minted', event_args_config={ "value": (Gauge, f'{metrics_prefix}_mined_value', 'Minted value'), "period": (Gauge, f'{metrics_prefix}_mined_period', 'Minted period'), "block_number": (Gauge, f'{metrics_prefix}_mined_block_number', 'Minted block number') }, argument_filters={'staker': staker_address}, contract_agent=staking_agent)) # Slashed collectors.append( EventMetricsCollector( event_name='Slashed', event_args_config={ "penalty": (Gauge, f'{metrics_prefix}_last_slashed_penalty', 'Penalty for slashing'), "block_number": (Gauge, f'{metrics_prefix}_last_slashed_penalty_block_number', 'Slashed penalty block number') }, argument_filters={'staker': staker_address}, contract_agent=staking_agent)) # RestakeSet collectors.append( ReStakeEventMetricsCollector(event_args_config={ "reStake": (Gauge, f'{metrics_prefix}_restaking', 'Restake set') }, staker_address=staker_address, contract_agent=staking_agent)) # WindDownSet collectors.append( WindDownEventMetricsCollector(event_args_config={ "windDown": (Gauge, f'{metrics_prefix}_wind_down', 'is windDown') }, staker_address=staker_address, contract_agent=staking_agent)) # WorkerBonded collectors.append( WorkerBondedEventMetricsCollector(event_args_config={ "startPeriod": (Gauge, f'{metrics_prefix}_worker_set_start_period', 'New worker was bonded'), "block_number": (Gauge, f'{metrics_prefix}_worker_set_block_number', 'WorkerBonded block number') }, staker_address=staker_address, worker_address=ursula.worker_address, contract_agent=staking_agent)) return collectors