monitor

package
v0.0.0-...-29137c7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AttrKeyBeholderDataSchema = "beholder_data_schema"
	AttrKeyBeholderEntity     = "beholder_entity"
	AttrKeyBeholderDomain     = "beholder_domain"
)
View Source
const (
	// Helper keys to avoid duplicating attributes
	CtxKeySkipAppendAttrs = "skip_append_attrs"
)

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.

func NewGenericBalanceMonitor

func NewGenericBalanceMonitor(opts GenericBalanceMonitorOpts) (services.Service, error)

TODO: This implementation is chain-agnotic, so it should be moved to the common package and reused by all chains.

  • Solana: /solana/pkg/solana/monitor
  • TRON: /tron/relayer/monitor

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

Types

type BalanceMonitorOpts

type BalanceMonitorOpts struct {
	ChainInfo ChainInfo

	Config    GenericBalanceConfig
	Logger    logger.Logger
	Keystore  core.Keystore
	NewClient func() (aptos.AptosRpcClient, error)
}

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

type BeholderClient

type BeholderClient struct {
	*beholder.Client
	ProtoEmitter ProtoEmitter
}

BeholderClient is a Beholder client extension with a custom ProtoEmitter

type ChainInfo

type ChainInfo struct {
	ChainFamilyName string
	ChainID         string
	NetworkName     string
	NetworkNameFull string
}

TODO: duplicate of "github.com/smartcontractkit/chainlink-aptos/relayer/write_target.ChainInfo" (reuse) ChainInfo contains the chain information (used as execution context)

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 ChainInfo) attribute.Set

func (*GaugeAccBalance) Record

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

type GenericBalanceClient

type GenericBalanceClient interface {
	GetAccountBalance(addr string) (float64, error)
}

GenericBalanceClient defines the interface for getting account balances.

type GenericBalanceConfig

type GenericBalanceConfig struct {
	BalancePollPeriod config.Duration
}

Config defines the balance monitor configuration.

type GenericBalanceMonitorOpts

type GenericBalanceMonitorOpts struct {
	ChainInfo           ChainInfo
	ChainNativeCurrency string

	Config                  GenericBalanceConfig
	Logger                  logger.Logger
	Keystore                core.Keystore
	NewGenericBalanceClient func() (GenericBalanceClient, error)

	// Maps a public key to an account address (optional, can return key as is)
	KeyToAccountMapper func(context.Context, string) (string, error)
}

GenericBalanceMonitorOpts contains the options for creating a new balance monitor.

type ProtoEmitter

type ProtoEmitter interface {
	// Sends message with bytes and attributes to OTel Collector
	Emit(ctx context.Context, m proto.Message, attrKVs ...any) error
	EmitWithLog(ctx context.Context, m proto.Message, attrKVs ...any) error
}

ProtoEmitter is an interface for emitting protobuf messages TODO: this should be moved to chainlink-common

func NewProtoEmitter

func NewProtoEmitter(lggr logger.Logger, client *beholder.Client, schemaBasePath string) ProtoEmitter

type ProtoProcessor

type ProtoProcessor interface {
	Process(ctx context.Context, m proto.Message, attrKVs ...any) error
}

ProtoProcessor is an interface for processing emitted protobuf messages

Jump to

Keyboard shortcuts

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