api

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetSpanListMethod                   = "GetSpanList"
	GetLatestSpanMethod                 = "GetLatestSpan"
	GetNextSpanSeedMethod               = "GetNextSpanSeed"
	GetNextSpanMethod                   = "GetNextSpan"
	GetSpanByIdMethod                   = "GetSpanById"
	GetBorParamsMethod                  = "GetBorParams"
	GetProducerVotesMethod              = "GetProducerVotes"
	GetProducerVotesByValidatorIdMethod = "GetProducerVotesByValidatorId"
	GetProducerPlannedDowntimeMethod    = "GetProducerPlannedDowntime"
	GetValidatorPerformanceScoreMethod  = "GetValidatorPerformanceScore"

	ProposeSpanMethod      = "ProposeSpan"
	BorUpdateParamsMethod  = "UpdateParams"
	BackfillSpansMethod    = "BackfillSpans"
	VoteProducersMethod    = "VoteProducers"
	ProducerDowntimeMethod = "ProducerDowntime"

	SideHandleMsgSpanMethod                = "SideHandleMsgSpan"
	SideHandleMsgSetProducerDowntimeMethod = "SideHandleMsgSetProducerDowntime"

	PostHandleMsgSpanMethod                = "PostHandleMsgSpan"
	PostHandleMsgBackfillSpansMethod       = "PostHandleMsgBackfillSpans"
	PostHandleMsgSetProducerDowntimeMethod = "PostHandleMsgSetProducerDowntime"
)
View Source
const (
	GetCheckpointParamsMethod     = "GetCheckpointParams"
	GetCheckpointOverviewMethod   = "GetCheckpointOverview"
	GetAckCountMethod             = "GetAckCount"
	GetCheckpointLatestMethod     = "GetCheckpointLatest"
	GetCheckpointBufferMethod     = "GetCheckpointBuffer"
	GetLastNoAckMethod            = "GetLastNoAck"
	GetNextCheckpointMethod       = "GetNextCheckpoint"
	GetCheckpointListMethod       = "GetCheckpointList"
	GetCheckpointSignaturesMethod = "GetCheckpointSignatures"
	GetCheckpointMethod           = "GetCheckpoint"

	CheckpointMethod             = "Checkpoint"
	CheckpointAckMethod          = "CheckpointAck"
	CheckpointNoAckMethod        = "CheckpointNoAck"
	CheckpointUpdateParamsMethod = "UpdateParams"

	SideHandleMsgCheckpointMethod    = "SideHandleMsgCheckpoint"
	SideHandleMsgCheckpointAckMethod = "SideHandleMsgCheckpointAck"

	PostHandleMsgCheckpointMethod    = "PostHandleMsgCheckpoint"
	PostHandleMsgCheckpointAckMethod = "PostHandleMsgCheckpointAck"
)
View Source
const (
	GetRecordCountMethod        = "GetRecordCount"
	GetRecordListMethod         = "GetRecordList"
	GetLatestRecordIdMethod     = "GetLatestRecordId"
	GetRecordByIdMethod         = "GetRecordById"
	GetRecordListWithTimeMethod = "GetRecordListWithTime"
	GetRecordSequenceMethod     = "GetRecordSequence"
	IsClerkTxOldMethod          = "IsClerkTxOld"

	HandleMsgEventRecordMethod = "HandleMsgEventRecord"

	SideHandleMsgEventRecordMethod = "SideHandleMsgEventRecord"

	PostHandleMsgEventRecordMethod = "PostHandleMsgEventRecord"
)
View Source
const (
	// QueryType is the type of the API call.
	QueryType = "query"
	// TxType is the type of the API call.
	TxType = "tx"
	// SideType is the type of the side-handler call.
	SideType = "side"
	// PostType is the type of the post-handler call.
	PostType = "post"

	BorSubsystem        = "bor"
	CheckpointSubsystem = "checkpoint"
	ClerkSubsystem      = "clerk"
	MilestoneSubsystem  = "milestone"
	StakeSubsystem      = "stake"
	TopupSubsystem      = "topup"
)
View Source
const (
	GetMilestoneParamsMethod   = "GetMilestoneParams"
	GetMilestoneCountMethod    = "GetMilestoneCount"
	GetLatestMilestoneMethod   = "GetLatestMilestone"
	GetMilestoneByNumberMethod = "GetMilestoneByNumber"

	MilestoneUpdateParamsMethod = "UpdateParams"
)
View Source
const (
	GetCurrentValidatorSetMethod = "GetCurrentValidatorSet"
	GetSignerByAddressMethod     = "GetSignerByAddress"
	GetValidatorByIdMethod       = "GetValidatorById"
	GetTotalPowerMethod          = "GetTotalPower"
	IsStakeTxOldMethod           = "IsStakeTxOld"
	GetCurrentProposerMethod     = "GetCurrentProposer"
	GetProposersByTimesMethod    = "GetProposersByTimes"

	ValidatorJoinMethod = "ValidatorJoin"
	StakeUpdateMethod   = "StakeUpdate"
	SignerUpdateMethod  = "SignerUpdate"
	ValidatorExitMethod = "ValidatorExit"

	SideHandleMsgValidatorJoinMethod = "SideHandleMsgValidatorJoin"
	SideHandleMsgStakeUpdateMethod   = "SideHandleMsgStakeUpdate"
	SideHandleMsgSignerUpdateMethod  = "SideHandleMsgSignerUpdate"
	SideHandleMsgValidatorExitMethod = "SideHandleMsgValidatorExit"

	PostHandleMsgValidatorJoinMethod = "PostHandleMsgValidatorJoin"
	PostHandleMsgStakeUpdateMethod   = "PostHandleMsgStakeUpdate"
	PostHandleMsgSignerUpdateMethod  = "PostHandleMsgSignerUpdate"
	PostHandleMsgValidatorExitMethod = "PostHandleMsgValidatorExit"
)
View Source
const (
	IsTopupTxOldMethod                = "IsTopupTxOld"
	GetTopupTxSequenceMethod          = "GetTopupTxSequence"
	GetDividendAccountByAddressMethod = "GetDividendAccountByAddress"
	GetDividendAccountRootHashMethod  = "GetDividendAccountRootHash"
	VerifyAccountProofByAddressMethod = "VerifyAccountProofByAddress"
	GetAccountProofByAddressMethod    = "GetAccountProofByAddress"

	HandleTopupTxMethod = "HandleTopupTx"
	WithdrawFeeTxMethod = "WithdrawFeeTx"

	SideHandleTopupTxMethod = "SideHandleTopupTx"

	PostHandleTopupTxMethod = "PostHandleTopupTx"
)

Variables

This section is empty.

Functions

func RecordAPICall

func RecordAPICall(subsystem, method, apiType string, success bool, duration time.Duration)

RecordAPICall is the main generic function to record API metrics for any module.

func RecordAPICallWithStart

func RecordAPICallWithStart(subsystem, method, apiType string, success bool, start time.Time)

RecordAPICallWithStart is a convenience function that calculates duration from start time.

Types

type ModuleMetrics

type ModuleMetrics struct {
	// Total API calls counter.
	TotalCalls *prometheus.CounterVec
	// Successful API calls counter.
	SuccessCalls *prometheus.CounterVec
	// API response time summary.
	ResponseTime *prometheus.SummaryVec
}

ModuleMetrics holds the API metrics for a specific module.

func GetModuleMetrics

func GetModuleMetrics(subsystem string) *ModuleMetrics

GetModuleMetrics returns or creates metrics for a given module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL