metrics

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "op_dispute_mon"

Variables

This section is empty.

Functions

func ZeroClaimStatuses added in v1.7.6

func ZeroClaimStatuses() map[ClaimStatus]int

Types

type ClaimStatus added in v1.7.3

type ClaimStatus uint8
const (
	// Claims where the game is in the first half
	FirstHalfExpiredResolved ClaimStatus = iota
	FirstHalfExpiredUnresolved
	FirstHalfNotExpiredResolved
	FirstHalfNotExpiredUnresolved

	// Claims where the game is in the second half
	SecondHalfExpiredResolved
	SecondHalfExpiredUnresolved
	SecondHalfNotExpiredResolved
	SecondHalfNotExpiredUnresolved
)

type CreditExpectation added in v1.7.3

type CreditExpectation uint8
const (
	// Max Duration reached
	CreditBelowMaxDuration CreditExpectation = iota
	CreditEqualMaxDuration
	CreditAboveMaxDuration

	// Max Duration not reached
	CreditBelowNonMaxDuration
	CreditEqualNonMaxDuration
	CreditAboveNonMaxDuration
)

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)

	RecordClaims(status ClaimStatus, count int)

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

	RecordOutputFetchTime(timestamp float64)

	RecordGameAgreement(status GameAgreementStatus, count int)

	RecordLatestProposals(latestValid, latestInvalid uint64)

	RecordIgnoredGames(count int)

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

	RecordL2Challenges(agreement bool, count int)

	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 *big.Int, available *big.Int)

func (*Metrics) RecordClaims added in v1.7.3

func (m *Metrics) RecordClaims(status ClaimStatus, count int)

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) 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) RecordMonitorDuration added in v1.7.6

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

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, _ *big.Int)

func (*NoopMetricsImpl) RecordClaims added in v1.7.3

func (*NoopMetricsImpl) RecordClaims(_ ClaimStatus, _ int)

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) 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, _ uint64)

func (*NoopMetricsImpl) RecordMonitorDuration added in v1.7.6

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

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