Documentation
¶
Overview ¶
Package balance provides a generic chain-agnostic balance monitoring service that tracks account balances across different blockchain networks.
Package balance provides a generic chain-agnostic balance monitoring service that tracks account balances across different blockchain networks.
Package balance provides a generic chain-agnostic balance monitoring service that tracks account balances across different blockchain networks.
Index ¶
- Constants
- func NewGenericBalanceMonitor(opts GenericBalanceMonitorOpts) (services.Service, error)
- func ValOrUnknown(val string) string
- func ValShortOrUnknown(val string, maxLen int) string
- type ChainInfo
- type ExecutionMetadata
- type GaugeAccBalance
- type GenericBalanceClient
- type GenericBalanceConfig
- type GenericBalanceMonitorOpts
Constants ¶
const ( // WorkflowExecutionIDShortLen is the length of the short version of the WorkflowExecutionId (label) WorkflowExecutionIDShortLen = 3 // first 3 characters, 16^3 = 4.096 possibilities (mid-high cardinality) )
Variables ¶
This section is empty.
Functions ¶
func NewGenericBalanceMonitor ¶
func NewGenericBalanceMonitor(opts GenericBalanceMonitorOpts) (services.Service, error)
NewGenericBalanceMonitor returns a balance monitoring services.Service which reports the balance of all Keystore accounts.
func ValOrUnknown ¶
ValOrUnknown returns the value if it is not empty, otherwise it returns "unknown" This is needed to avoid issues during exporting OTel metrics to Prometheus For more details see https://smartcontract-it.atlassian.net/browse/INFOPLAT-1349
func ValShortOrUnknown ¶
ValShortOrUnknown returns the short len value if not empty or available, otherwise it returns "unknown"
Types ¶
type ChainInfo ¶
type ChainInfo struct {
ChainFamilyName string
ChainID string
NetworkName string
NetworkNameFull string
}
ChainInfo contains information about the blockchain network.
type ExecutionMetadata ¶
type ExecutionMetadata struct {
// Execution Context - Source
SourceID string
// Execution Context - Chain
ChainFamilyName string
ChainID string
NetworkName string
NetworkNameFull string
// Execution Context - Workflow (capabilities.RequestMetadata)
WorkflowID string
WorkflowOwner string
WorkflowExecutionID string
WorkflowName string
WorkflowDonID uint32
WorkflowDonConfigVersion uint32
ReferenceID string
// Execution Context - Capability
CapabilityType string
CapabilityID string
CapabilityTimestampStart uint32
CapabilityTimestampEmit uint32
}
TODO: Refactor as a proto referenced from the other proto files (telemetry messages)
func (ExecutionMetadata) Attributes ¶
func (m ExecutionMetadata) Attributes() []attribute.KeyValue
Attributes returns common attributes used for metrics
type GaugeAccBalance ¶
type GaugeAccBalance struct {
// contains filtered or unexported fields
}
GaugeAccBalance defines 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
type GenericBalanceClient ¶
GenericBalanceClient defines the interface for getting account balances.
type GenericBalanceConfig ¶
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.