executor

package
v0.0.0-...-3ac4113 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TickPeriodSecond = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedAlert

type AggregatedAlert struct {
	CumulatedCount  uint32           `json:"cumulated_count"`
	FirstAlertTime  string           `json:"first_alert_time"`
	LastAlertTime   string           `json:"last_alert_time"`
	LastAlertValues []RecordedMetric `json:"last_alert_values"`
}

type AlertReceiver

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

func NewAlertReceiver

func NewAlertReceiver() *AlertReceiver

func (*AlertReceiver) ExtractAlerts

func (ar *AlertReceiver) ExtractAlerts() error

func (*AlertReceiver) HandleAlert

func (ar *AlertReceiver) HandleAlert(handlerNum string)

func (*AlertReceiver) Serve

func (ar *AlertReceiver) Serve()

func (*AlertReceiver) SetExecutor

func (ar *AlertReceiver) SetExecutor(executor *Executor)

type AlertRunner

type AlertRunner struct {
	AlertConfig ConfigAlert
	AlertStatus StatusAlert
	SignalCh    chan string
	UpdateCh    chan string
}

func NewAlertRunner

func NewAlertRunner(alertId string, updateCh chan string) *AlertRunner

func (*AlertRunner) GetAlertStatus

func (ar *AlertRunner) GetAlertStatus() (string, time.Time)

func (*AlertRunner) Run

func (ar *AlertRunner) Run(initStatus string)

type AliveReporter

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

func NewAliveReporter

func NewAliveReporter() *AliveReporter

func (*AliveReporter) CheckExist

func (ar *AliveReporter) CheckExist() bool

func (*AliveReporter) HeartBeat

func (ar *AliveReporter) HeartBeat()

func (*AliveReporter) HeartBoot

func (ar *AliveReporter) HeartBoot()

func (*AliveReporter) SetExecutor

func (ar *AliveReporter) SetExecutor(executor *Executor)

type BroadcastInfo

type BroadcastInfo struct {
	AlertId   string
	Operation string
}

BroadcastInfo is the service register information to etcd

type BroadcastReceiver

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

func NewBroadcastReceiver

func NewBroadcastReceiver() *BroadcastReceiver

func (*BroadcastReceiver) SetExecutor

func (br *BroadcastReceiver) SetExecutor(executor *Executor)

func (*BroadcastReceiver) WatchBroadcast

func (br *BroadcastReceiver) WatchBroadcast()

type ConfigAlert

type ConfigAlert struct {
	AlertId            string
	LoadSuccess        bool
	Disabled           bool
	RsTypeName         string
	RsTypeParam        string
	RsFilterName       string
	RsFilterParam      string
	PolicyConfig       map[string]ConfigPolicy `json:"policy_config"`
	AvailableStartTime string
	AvailableEndTime   string
	Language           string
	Rules              map[string]RuleInfo
	Requests           MonitoringRequest
	NfAddressListId    string
}

type ConfigPolicy

type ConfigPolicy struct {
	RepeatType              string `json:"repeat_type"`
	RepeatIntervalInitvalue uint32 `json:"repeat_interval_initvalue"`
	MaxSendCount            uint32 `json:"max_send_count"`
}

type Executor

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

func Init

func Init(name string) *Executor

func NewExecutor

func NewExecutor(name string, alertReceiver *AlertReceiver, aliveReporter *AliveReporter, broadcastReceiver *BroadcastReceiver, healthChecker *HealthChecker) *Executor

func (*Executor) AddAlert

func (e *Executor) AddAlert(alertId string)

func (*Executor) CheckExist

func (e *Executor) CheckExist() bool

func (*Executor) DeleteAllAlerts

func (e *Executor) DeleteAllAlerts()

func (*Executor) GetName

func (e *Executor) GetName() string

func (*Executor) GetRunners

func (e *Executor) GetRunners() []rs.RunnerInfo

func (*Executor) GetTaskCount

func (e *Executor) GetTaskCount() int

func (*Executor) HeartBoot

func (e *Executor) HeartBoot()

func (*Executor) ProcessAlert

func (e *Executor) ProcessAlert(alertId string, operation string)

func (*Executor) Serve

func (e *Executor) Serve()

func (*Executor) TerminateRunner

func (e *Executor) TerminateRunner(alertId string)

type ExecutorInfo

type ExecutorInfo struct {
	Name      string
	TaskCount int
}

ExecutorInfo is the service register information to etcd

type HealthChecker

type HealthChecker struct {
	UpdateCh      chan string
	RequestStatus UpdateRequest
	// contains filtered or unexported fields
}

func NewHealthChecker

func NewHealthChecker() *HealthChecker

func (*HealthChecker) HealthCheck

func (hc *HealthChecker) HealthCheck()

func (*HealthChecker) SetExecutor

func (hc *HealthChecker) SetExecutor(executor *Executor)

func (*HealthChecker) UpdateLoop

func (hc *HealthChecker) UpdateLoop()

type MonitoringRequest

type MonitoringRequest struct {
	RulesSamePeriod map[uint32][]string
	TickCount       map[uint32]uint32
	TickUpperBound  map[uint32]uint32
}

type RecordedMetric

type RecordedMetric struct {
	RuleName     string
	ResourceName string
	// contains filtered or unexported fields
}

type RuleInfo

type RuleInfo struct {
	RuleName         string
	Disabled         bool
	MonitorPeriods   uint32
	Severity         string
	MetricsType      string
	ConditionType    string
	Thresholds       float64
	Scale            float64
	Unit             string
	ConsecutiveCount uint32
	Inhibit          bool
	MetricName       string
}

type Runner

type Runner struct {
	sync.RWMutex
	Map map[string]*AlertRunner
}

type StatusAlert

type StatusAlert struct {
	sync.RWMutex
	ResourceStatus map[string]StatusResource `json:resource_status`
	UpdateTime     time.Time
}

type StatusResource

type StatusResource struct {
	CurrentLevel       string          `json:current_level`
	PositiveCount      uint32          `json:positive_count`
	CumulatedSendCount uint32          `json:cumulated_send_count`
	NextResendInterval uint32          `json:next_resend_interval`
	NextSendableTime   time.Time       `json:next_sendable_time`
	AggregatedAlerts   AggregatedAlert `json:aggregated_alerts`
}

type UpdateRequest

type UpdateRequest struct {
	sync.RWMutex
	RequestCount int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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