metrics

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "op_dispute_mon"

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimStatus added in v1.7.3

type ClaimStatus struct {
	// contains filtered or unexported fields
}

func NewClaimStatus added in v1.7.7

func NewClaimStatus(firstHalf, clockExpired, resolvable, resolved bool) ClaimStatus

func (ClaimStatus) AsLabels added in v1.7.7

func (s ClaimStatus) AsLabels() []string

func (ClaimStatus) String added in v1.7.7

func (s ClaimStatus) String() string

type ClaimStatuses added in v1.7.7

type ClaimStatuses struct {
	// contains filtered or unexported fields
}

func (*ClaimStatuses) ForEachStatus added in v1.7.7

func (c *ClaimStatuses) ForEachStatus(callback func(status ClaimStatus, count int))

ForEachStatus iterates through all possible statuses and calls the callback function with the status and count of claims. This ensures that statuses that have no claims counted against them are still considered to have 0 claims.

func (*ClaimStatuses) RecordClaim added in v1.7.7

func (c *ClaimStatuses) RecordClaim(firstHalf, clockExpired, resolvable, resolved bool)

type CreditExpectation added in v1.7.3

type CreditExpectation uint8
const (
	// Max Duration reached
	CreditBelowWithdrawable CreditExpectation = iota
	CreditEqualWithdrawable
	CreditAboveWithdrawable

	// Max Duration not reached
	CreditBelowNonWithdrawable
	CreditEqualNonWithdrawable
	CreditAboveNonWithdrawable
)

type GameAgreementStatus added in v1.7.0

type GameAgreementStatus uint8
const (
	// In progress
	AgreeChallengerAhead GameAgreementStatus = iota
	DisagreeChallengerAhead
	AgreeDefenderAhead
	DisagreeDefenderAhead

	// Completed
	AgreeDefenderWins
	DisagreeDefenderWins
	AgreeChallengerWins
	DisagreeChallengerWins
)

type HonestActorData added in v1.7.6

type HonestActorData struct {
	PendingClaimCount int
	ValidClaimCount   int
	InvalidClaimCount int
	PendingBonds      *big.Int
	LostBonds         *big.Int
	WonBonds          *big.Int
}

type Metricer

type Metricer interface {
	RecordInfo(version string)
	RecordUp()

	RecordMonitorDuration(dur time.Duration)

	RecordFailedGames(count int)

	RecordHonestActorClaims(address common.Address, stats *HonestActorData)

	RecordGameResolutionStatus(status ResolutionStatus, count int)

	RecordCredit(expectation CreditExpectation, count int)

	RecordHonestWithdrawableAmounts(map[common.Address]*big.Int)

	RecordClaims(statuses *ClaimStatuses)

	RecordWithdrawalRequests(delayedWeth common.Address, matches bool, count int)

	RecordOutputFetchTime(timestamp float64)

	RecordGameAgreement(status GameAgreementStatus, count int)

	RecordLatestValidProposalL2Block(latestValid uint64)

	RecordLatestProposals(latestValid, latestInvalid uint64)

	RecordIgnoredGames(count int)

	RecordBondCollateral(addr common.Address, required, available *big.Int)

	RecordL2Challenges(agreement bool, count int)

	RecordOldestGameUpdateTime(t time.Time)

	caching.Metrics
	contractMetrics.ContractMetricer
}
var NoopMetrics Metricer = new(NoopMetricsImpl)

type Metrics

type Metrics struct {
	*opmetrics.CacheMetrics
	*contractMetrics.ContractMetrics
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Document

func (m *Metrics) Document() []opmetrics.DocumentedMetric

func (*Metrics) RecordBondCollateral added in v1.7.2

func (m *Metrics) RecordBondCollateral(addr common.Address, required, available *big.Int)

func (*Metrics) RecordClaims added in v1.7.3

func (m *Metrics) RecordClaims(statuses *ClaimStatuses)

func (*Metrics) RecordCredit added in v1.7.3

func (m *Metrics) RecordCredit(expectation CreditExpectation, count int)

func (*Metrics) RecordFailedGames added in v1.7.6

func (m *Metrics) RecordFailedGames(count int)

func (*Metrics) RecordGameAgreement added in v1.6.1

func (m *Metrics) RecordGameAgreement(status GameAgreementStatus, count int)

func (*Metrics) RecordGameResolutionStatus added in v1.7.3

func (m *Metrics) RecordGameResolutionStatus(status ResolutionStatus, count int)

func (*Metrics) RecordHonestActorClaims added in v1.7.6

func (m *Metrics) RecordHonestActorClaims(address common.Address, stats *HonestActorData)

func (*Metrics) RecordHonestWithdrawableAmounts added in v1.8.0

func (m *Metrics) RecordHonestWithdrawableAmounts(amounts map[common.Address]*big.Int)

func (*Metrics) RecordIgnoredGames added in v1.7.6

func (m *Metrics) RecordIgnoredGames(count int)

func (*Metrics) RecordInfo

func (m *Metrics) RecordInfo(version string)

RecordInfo sets a pseudo-metric that contains versioning and config info for the op-proposer.

func (*Metrics) RecordL2Challenges added in v1.7.6

func (m *Metrics) RecordL2Challenges(agreement bool, count int)

func (*Metrics) RecordLatestProposals added in v1.7.6

func (m *Metrics) RecordLatestProposals(latestValid, latestInvalid uint64)

func (*Metrics) RecordLatestValidProposalL2Block added in v1.9.0

func (m *Metrics) RecordLatestValidProposalL2Block(latestValid uint64)

func (*Metrics) RecordMonitorDuration added in v1.7.6

func (m *Metrics) RecordMonitorDuration(dur time.Duration)

func (*Metrics) RecordOldestGameUpdateTime added in v1.9.5

func (m *Metrics) RecordOldestGameUpdateTime(t time.Time)

func (*Metrics) RecordOutputFetchTime added in v1.7.2

func (m *Metrics) RecordOutputFetchTime(timestamp float64)

func (*Metrics) RecordUp

func (m *Metrics) RecordUp()

RecordUp sets the up metric to 1.

func (*Metrics) RecordWithdrawalRequests added in v1.7.3

func (m *Metrics) RecordWithdrawalRequests(delayedWeth common.Address, matches bool, count int)

func (*Metrics) Registry

func (m *Metrics) Registry() *prometheus.Registry

func (*Metrics) Start

func (m *Metrics) Start(host string, port int) (*httputil.HTTPServer, error)

func (*Metrics) StartBalanceMetrics

func (m *Metrics) StartBalanceMetrics(
	l log.Logger,
	client *ethclient.Client,
	account common.Address,
) io.Closer

type NoopMetricsImpl

type NoopMetricsImpl struct {
	contractMetrics.NoopMetrics
}

func (*NoopMetricsImpl) CacheAdd

func (*NoopMetricsImpl) CacheAdd(_ string, _ int, _ bool)

func (*NoopMetricsImpl) CacheGet

func (*NoopMetricsImpl) CacheGet(_ string, _ bool)

func (*NoopMetricsImpl) RecordBondCollateral added in v1.7.2

func (*NoopMetricsImpl) RecordBondCollateral(_ common.Address, _, _ *big.Int)

func (*NoopMetricsImpl) RecordClaims added in v1.7.3

func (*NoopMetricsImpl) RecordClaims(_ *ClaimStatuses)

func (*NoopMetricsImpl) RecordCredit added in v1.7.3

func (*NoopMetricsImpl) RecordCredit(_ CreditExpectation, _ int)

func (*NoopMetricsImpl) RecordFailedGames added in v1.7.6

func (*NoopMetricsImpl) RecordFailedGames(_ int)

func (*NoopMetricsImpl) RecordGameAgreement added in v1.6.1

func (*NoopMetricsImpl) RecordGameAgreement(_ GameAgreementStatus, _ int)

func (*NoopMetricsImpl) RecordGameResolutionStatus added in v1.7.3

func (*NoopMetricsImpl) RecordGameResolutionStatus(_ ResolutionStatus, _ int)

func (*NoopMetricsImpl) RecordHonestActorClaims added in v1.7.6

func (*NoopMetricsImpl) RecordHonestActorClaims(_ common.Address, _ *HonestActorData)

func (*NoopMetricsImpl) RecordHonestWithdrawableAmounts added in v1.8.0

func (*NoopMetricsImpl) RecordHonestWithdrawableAmounts(map[common.Address]*big.Int)

func (*NoopMetricsImpl) RecordIgnoredGames added in v1.7.6

func (*NoopMetricsImpl) RecordIgnoredGames(_ int)

func (*NoopMetricsImpl) RecordInfo

func (*NoopMetricsImpl) RecordInfo(_ string)

func (*NoopMetricsImpl) RecordL2Challenges added in v1.7.6

func (*NoopMetricsImpl) RecordL2Challenges(_ bool, _ int)

func (*NoopMetricsImpl) RecordLatestProposals added in v1.7.6

func (*NoopMetricsImpl) RecordLatestProposals(_, _ uint64)

func (*NoopMetricsImpl) RecordLatestValidProposalL2Block added in v1.9.0

func (*NoopMetricsImpl) RecordLatestValidProposalL2Block(_ uint64)

func (*NoopMetricsImpl) RecordMonitorDuration added in v1.7.6

func (*NoopMetricsImpl) RecordMonitorDuration(_ time.Duration)

func (*NoopMetricsImpl) RecordOldestGameUpdateTime added in v1.9.5

func (*NoopMetricsImpl) RecordOldestGameUpdateTime(_ time.Time)

func (*NoopMetricsImpl) RecordOutputFetchTime added in v1.7.2

func (*NoopMetricsImpl) RecordOutputFetchTime(_ float64)

func (*NoopMetricsImpl) RecordUp

func (*NoopMetricsImpl) RecordUp()

func (*NoopMetricsImpl) RecordWithdrawalRequests added in v1.7.3

func (*NoopMetricsImpl) RecordWithdrawalRequests(_ common.Address, _ bool, _ int)

type ResolutionStatus added in v1.7.6

type ResolutionStatus uint8
const (
	// In progress
	CompleteMaxDuration ResolutionStatus = iota
	CompleteBeforeMaxDuration

	// Resolvable
	ResolvableMaxDuration
	ResolvableBeforeMaxDuration

	// Not resolvable
	InProgressMaxDuration
	InProgressBeforeMaxDuration
)

Jump to

Keyboard shortcuts

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