monitor

package
v0.0.0-...-96ac6b9 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentSuiRelayer          = "SuiRelayer"
	ComponentTxM                 = "TxM"
	ComponentChainPoller         = "ChainPoller"
	ComponentEventsIndexer       = "EventsIndexer"
	ComponentTransactionsIndexer = "TransactionsIndexer"
	ComponentChainReader         = "ChainReader"
	ComponentChainWriter         = "ChainWriter"
)

Component names for health metrics

View Source
const BalanceCheckTimeout = 30 * time.Second
View Source
const SuiDecimals = 9
View Source
const SuiDecimalsDenominator = 1_000_000_000

Variables

This section is empty.

Functions

func NewBalanceMonitor

func NewBalanceMonitor(opts BalanceMonitorOpts) (services.Service, error)

NewBalanceMonitor returns a balance monitoring services.Service which reports balance of all Keystore accounts.

Types

type BalanceMonitorOpts

type BalanceMonitorOpts struct {
	ChainInfo aptosTypes.ChainInfo

	Config    aptosBalanceMonitor.GenericBalanceConfig
	Logger    logger.Logger
	Keystore  core.Keystore
	NewClient func() (client.SuiPTBClient, error)
}

BalanceMonitorOpts contains the options for creating a new Sui account balance monitor.

type GaugeAccBalance

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

Define a new gauge metric for account balance

func NewGaugeAccBalance

func NewGaugeAccBalance(unitStr string) (*GaugeAccBalance, error)

func (*GaugeAccBalance) GetAttributes

func (g *GaugeAccBalance) GetAttributes(account string, chainInfo aptosTypes.ChainInfo) attribute.Set

func (*GaugeAccBalance) Record

func (g *GaugeAccBalance) Record(ctx context.Context, balance float64, account string, chainInfo aptosTypes.ChainInfo)

type GaugeRPCTxDuration

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

Define a metrics for RPC response speeds

func NewGaugeRPCTxDuration

func NewGaugeRPCTxDuration(unitStr string) (*GaugeRPCTxDuration, error)

func (*GaugeRPCTxDuration) Record

func (g *GaugeRPCTxDuration) Record(ctx context.Context, duration int64, method string, responseCode string)

type HealthMetrics

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

HealthMetrics provides per-component health metrics that are pushed to Grafana. It tracks component status, flip-flop counts, and processing lag for monitoring and alerting purposes.

func NewHealthMetrics

func NewHealthMetrics(chainInfo aptosTypes.ChainInfo) (*HealthMetrics, error)

NewHealthMetrics creates a new HealthMetrics instance and pre-registers all metrics. Metrics are registered at startup so they are always present for alerting.

func (*HealthMetrics) GetHealthStatus

func (hm *HealthMetrics) GetHealthStatus(component string) (bool, bool)

GetHealthStatus returns the last known health status for a component.

func (*HealthMetrics) GetLastSuccessTime

func (hm *HealthMetrics) GetLastSuccessTime(component string) (time.Time, bool)

GetLastSuccessTime returns the last success time for a component.

func (*HealthMetrics) RecordHealth

func (hm *HealthMetrics) RecordHealth(ctx context.Context, component string, healthy bool)

RecordHealth records the health status of a component and tracks flip-flops.

func (*HealthMetrics) RecordHealthFromReport

func (hm *HealthMetrics) RecordHealthFromReport(ctx context.Context, report map[string]error)

RecordHealthFromReport processes a HealthReport map and records metrics for all components.

func (*HealthMetrics) RecordLastSuccess

func (hm *HealthMetrics) RecordLastSuccess(ctx context.Context, component string)

RecordLastSuccess records the timestamp of a successful operation and updates the processing lag metric.

func (*HealthMetrics) UpdateProcessingLag

func (hm *HealthMetrics) UpdateProcessingLag(ctx context.Context)

UpdateProcessingLag updates the processing lag for all components based on their last success time. This should be called periodically.

Jump to

Keyboard shortcuts

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