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
- func ParseEndpoints(keyName string, viper_endpoints *viper.Viper) (endpoints []*lavasession.RPCEndpoint, err error)
- 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 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 = 40 )
View Source
const ( DefaultSuppressionCountThreshold = 3 DisableAlertLogging = "disable-alert-logging" SuppressionCountThresholdFlagName = "suppression-alert-count-threshold" )
Variables ¶
View Source
var QueryRetries = uint64(3)
Functions ¶
func CheckConsumersAndReferences ¶
func CheckConsumersAndReferences(ctx context.Context, clientCtx client.Context, referenceEndpoints []*lavasession.RPCEndpoint, consumerEndpoints []*lavasession.RPCEndpoint, healthResults *HealthResults, ) error
func CheckProviders ¶
func CheckProviders(ctx context.Context, clientCtx client.Context, healthResults *HealthResults, providerEntries map[LavaEntity]epochstoragetypes.StakeEntry) error
func ParseEndpoints ¶
func ParseEndpoints(keyName string, viper_endpoints *viper.Viper) (endpoints []*lavasession.RPCEndpoint, err 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 HealthResults ¶
type HealthResults struct { LatestBlocks map[string]int64 ProviderData map[LavaEntity]ReplyData ConsumerBlocks map[LavaEntity]int64 SubscriptionsData map[string]SubscriptionData FrozenProviders map[LavaEntity]struct{} UnhealthyProviders map[LavaEntity]string UnhealthyConsumers map[LavaEntity]string Specs map[string]*spectypes.Spec Lock sync.RWMutex }
func RunHealth ¶
func RunHealth(ctx context.Context, clientCtx client.Context, subscriptionAddresses []string, providerAddresses []string, consumerEndpoints []*lavasession.RPCEndpoint, referenceEndpoints []*lavasession.RPCEndpoint, 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 ¶
func (*LavaEntity) String ¶
func (e *LavaEntity) String() string
Click to show internal directories.
Click to hide internal directories.