Documentation ¶
Index ¶
- Constants
- Variables
- func CheckConsumersAndReferences(ctx context.Context, clientCtx client.Context, ...) error
- func CheckProviders(ctx context.Context, clientCtx client.Context, healthResults *HealthResults, ...) error
- func CreateHealthCobraCommand() *cobra.Command
- type AlertAttribute
- type AlertCount
- type AlertEntry
- type Alerting
- func (al *Alerting) ActiveAlerts() (alerts uint64, unhealthy uint64, healthy uint64)
- func (al *Alerting) AppendUrlAlert(alert string, attrs []utils.Attribute)
- func (al *Alerting) CheckHealthResults(healthResults *HealthResults)
- func (al *Alerting) CheckSubscriptionData(subs map[string]SubscriptionData)
- func (al *Alerting) ConsumerAlerts(healthResults *HealthResults)
- func (al *Alerting) FilterOccurenceSuppresedAlerts(alert string, attributes []AlertAttribute) (filteredAttributes []AlertAttribute)
- func (al *Alerting) FilterTimeSuppresedAlerts(attributes []AlertAttribute, alert string) []utils.Attribute
- func (al *Alerting) ProvidersAlerts(healthResults *HealthResults)
- func (al *Alerting) SendAlert(alert string, attributes []AlertAttribute)
- func (al *Alerting) SendAppendedAlerts() error
- func (al *Alerting) SendFrozenProviders(frozenProviders map[LavaEntity]struct{})
- func (al *Alerting) SendRecoveryAlerts(alertEntries []AlertEntry)
- func (al *Alerting) ShouldAlertSubscription(data SubscriptionData) (reason string, alert bool)
- func (al *Alerting) UnhealthyProviders(unhealthy map[LavaEntity]string)
- type AlertingOptions
- type HealthPolicy
- type HealthRPCEndpoint
- type HealthResults
- func (healthResults *HealthResults) FormatForLatestBlock() map[string]uint64
- func (healthResults *HealthResults) FreezeProvider(providerKey LavaEntity)
- func (healthResults *HealthResults) GetAllEntities() map[LavaEntity]struct{}
- func (healthResults *HealthResults) SetProviderData(providerKey LavaEntity, latestData ReplyData)
- func (healthResults *HealthResults) SetUnhealthyProvider(providerKey LavaEntity, errMsg string)
- type LavaEntity
- type ReplyData
- type SubscriptionData
Constants ¶
View Source
const ( CacheMaxCost = 10 * 1024 // 10K cost CacheNumCounters = 100000 // expect 10K items OKString = "OK" FrozenProviderAttribute = "frozen_provider_alert" SubscriptionAlertAttribute = "subscription_limit_alert" UnhealthyProviderAttribute = "unhealthy_provider_alert" UnhealthyConsumerAttribute = "unhealthy_consumer_alert" ProviderBlockGapAttribute = "provider_block_gap_alert" ConsumerBlockGapAttribute = "consumer_block_gap_alert" ProviderLatencyAttribute = "provider_latency_alert" UsagePercentageAlert = "percentage of cu too low" LeftTimeAlert = "left subscription time is too low" MonthDuration = 30 * 24 * time.Hour )
View Source
const ( BasicQueryRetries = 3 QuerySleepTime = 100 * time.Millisecond NiceOutputLength = 100 )
View Source
const ( DefaultSuppressionCountThreshold = 3 DisableAlertLogging = "disable-alert-logging" SuppressionCountThresholdFlagName = "suppression-alert-count-threshold" AllProvidersFlagName = "all-providers" AllProvidersMarker = "all" ConsumerGrpcTLSFlagName = "consumer-grpc-tls" )
Variables ¶
View Source
var QueryRetries = uint64(3)
Functions ¶
func CheckConsumersAndReferences ¶
func CheckConsumersAndReferences(ctx context.Context, clientCtx client.Context, referenceEndpoints []*HealthRPCEndpoint, consumerEndpoints []*HealthRPCEndpoint, healthResults *HealthResults, ) error
func CheckProviders ¶
func CheckProviders(ctx context.Context, clientCtx client.Context, healthResults *HealthResults, providerEntries map[LavaEntity]epochstoragetypes.StakeEntry) error
Types ¶
type AlertAttribute ¶
type AlertAttribute struct {
// contains filtered or unexported fields
}
type AlertCount ¶
type AlertCount struct {
// contains filtered or unexported fields
}
type AlertEntry ¶
type AlertEntry struct {
// contains filtered or unexported fields
}
type Alerting ¶
func NewAlerting ¶
func NewAlerting(options AlertingOptions) *Alerting
func (*Alerting) ActiveAlerts ¶
func (*Alerting) AppendUrlAlert ¶
func (*Alerting) CheckHealthResults ¶
func (al *Alerting) CheckHealthResults(healthResults *HealthResults)
func (*Alerting) CheckSubscriptionData ¶
func (al *Alerting) CheckSubscriptionData(subs map[string]SubscriptionData)
func (*Alerting) ConsumerAlerts ¶
func (al *Alerting) ConsumerAlerts(healthResults *HealthResults)
func (*Alerting) FilterOccurenceSuppresedAlerts ¶
func (al *Alerting) FilterOccurenceSuppresedAlerts(alert string, attributes []AlertAttribute) (filteredAttributes []AlertAttribute)
func (*Alerting) FilterTimeSuppresedAlerts ¶
func (al *Alerting) FilterTimeSuppresedAlerts(attributes []AlertAttribute, alert string) []utils.Attribute
func (*Alerting) ProvidersAlerts ¶
func (al *Alerting) ProvidersAlerts(healthResults *HealthResults)
func (*Alerting) SendAlert ¶
func (al *Alerting) SendAlert(alert string, attributes []AlertAttribute)
func (al *Alerting) SendAlert(alert string, attrs []utils.Attribute) {
func (*Alerting) SendAppendedAlerts ¶
func (*Alerting) SendFrozenProviders ¶
func (al *Alerting) SendFrozenProviders(frozenProviders map[LavaEntity]struct{})
func (*Alerting) SendRecoveryAlerts ¶
func (al *Alerting) SendRecoveryAlerts(alertEntries []AlertEntry)
func (*Alerting) ShouldAlertSubscription ¶
func (al *Alerting) ShouldAlertSubscription(data SubscriptionData) (reason string, alert bool)
func (*Alerting) UnhealthyProviders ¶
func (al *Alerting) UnhealthyProviders(unhealthy map[LavaEntity]string)
type AlertingOptions ¶
type AlertingOptions struct { Url string // where to send the alerts Logging bool // wether to log alerts to stdout Identifier string // a unique identifier added to all alerts SubscriptionCUPercentageAlert float64 SubscriptionLeftTimeAlert time.Duration AllowedTimeGapVsReference time.Duration MaxProviderLatency time.Duration SameAlertInterval time.Duration DisableAlertSuppression bool SuppressionCounterThreshold uint64 }
type HealthPolicy ¶
type HealthPolicy struct {
// contains filtered or unexported fields
}
func (*HealthPolicy) GetSupportedAddons ¶
func (pp *HealthPolicy) GetSupportedAddons(specID string) (addons []string, err error)
func (*HealthPolicy) GetSupportedExtensions ¶
func (pp *HealthPolicy) GetSupportedExtensions(specID string) (extensions []epochstoragetypes.EndpointService, err error)
type HealthRPCEndpoint ¶
type HealthRPCEndpoint struct { NetworkAddress string `yaml:"network-address,omitempty" json:"network-address,omitempty" mapstructure:"network-address"` // HOST:PORT ChainID string `yaml:"chain-id,omitempty" json:"chain-id,omitempty" mapstructure:"chain-id"` // spec chain identifier ApiInterface string `yaml:"api-interface,omitempty" json:"api-interface,omitempty" mapstructure:"api-interface"` Geolocation uint64 `yaml:"geolocation,omitempty" json:"geolocation,omitempty" mapstructure:"geolocation"` Addons []string `yaml:"addons,omitempty" json:"addons,omitempty" mapstructure:"addons"` }
func ParseEndpoints ¶
func ParseEndpoints(keyName string, viper_endpoints *viper.Viper) (endpoints []*HealthRPCEndpoint, err error)
func (*HealthRPCEndpoint) String ¶
func (endpoint *HealthRPCEndpoint) String() string
type HealthResults ¶
type HealthResults struct { LatestBlocks map[string]int64 `json:"latestBlocks,omitempty"` ConsumerBlocks map[LavaEntity]int64 `json:"consumerBlocks,omitempty"` ProviderData map[LavaEntity]ReplyData `json:"providerData,omitempty"` SubscriptionsData map[string]SubscriptionData `json:"subscriptionsData,omitempty"` FrozenProviders map[LavaEntity]struct{} `json:"frozenProviders,omitempty"` UnhealthyProviders map[LavaEntity]string `json:"unhealthyProviders,omitempty"` UnhealthyConsumers map[LavaEntity]string `json:"unhealthyConsumers,omitempty"` Specs map[string]*spectypes.Spec `json:"specs,omitempty"` Lock sync.RWMutex `json:"-"` }
func RunHealth ¶
func RunHealth(ctx context.Context, clientCtx client.Context, subscriptionAddresses []string, providerAddresses []string, consumerEndpoints []*HealthRPCEndpoint, referenceEndpoints []*HealthRPCEndpoint, prometheusListenAddr string, ) (*HealthResults, error)
func (*HealthResults) FormatForLatestBlock ¶
func (healthResults *HealthResults) FormatForLatestBlock() map[string]uint64
func (*HealthResults) FreezeProvider ¶
func (healthResults *HealthResults) FreezeProvider(providerKey LavaEntity)
func (*HealthResults) GetAllEntities ¶
func (healthResults *HealthResults) GetAllEntities() map[LavaEntity]struct{}
func (*HealthResults) SetProviderData ¶
func (healthResults *HealthResults) SetProviderData(providerKey LavaEntity, latestData ReplyData)
func (*HealthResults) SetUnhealthyProvider ¶
func (healthResults *HealthResults) SetUnhealthyProvider(providerKey LavaEntity, errMsg string)
type LavaEntity ¶
type LavaEntity struct { Address string `json:"address"` SpecId string `json:"specId"` ApiInterface string `json:"apiInterface"` }
func (*LavaEntity) MarshalJSON ¶
func (le *LavaEntity) MarshalJSON() ([]byte, error)
func (LavaEntity) MarshalText ¶
func (le LavaEntity) MarshalText() ([]byte, error)
func (*LavaEntity) String ¶
func (e *LavaEntity) String() string
Click to show internal directories.
Click to hide internal directories.