monitor

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationInfo

type ApplicationInfo struct {
	Name     string               `json:"name"`
	Host     string               `json:"host"`
	Hostname string               `json:"hostname"`
	InitedAt time.Time            `json:"inited_at"`
	Tasks    map[string][]string  `json:"tasks"`
	Servers  map[string]time.Time `json:"servers,omitempty"`
}

ApplicationInfo with basic description

func (*ApplicationInfo) Merge

func (app *ApplicationInfo) Merge(info *ApplicationInfo)

Merge application info

type ClusterInfoReader

type ClusterInfoReader interface {
	ApplicationInfo() (*ApplicationInfo, error)
	TaskInfo(name string) (*TaskInfo, error)
	TaskInfoByID(id string) (*TaskInfo, error)
	ListOfNodes() (map[string][]string, int, error)
}

ClusterInfoReader provides methods of information reading

type EventType

type EventType interface {
	fmt.Stringer

	// ID of the event
	ID() uuid.UUID

	// Name of the event
	Name() string

	// Err returns error response object
	Err() error

	// CreatedAt returns the date of the event generation
	CreatedAt() time.Time
}

EventType defines minimal event functionality

func NewErrorEvent

func NewErrorEvent(err error) EventType

NewErrorEvent returns new type event with error

func WrapEventWithName

func WrapEventWithName(name string, event EventType) EventType

WrapEventWithName returns new wrapped event

type MetricReader

type MetricReader interface {
	ApplicationInfo() *ApplicationInfo
	ReceiveCount() (uint64, error)
	TaskInfo(name string) (*TaskInfo, error)
	FailoverTaskInfo(name string) (*TaskInfo, error)
}

MetricReader of information

type MetricUpdater

type MetricUpdater interface {
	RegisterApplication(appInfo *ApplicationInfo) error
	DeregisterApplication() error
	ReceiveEvent(event EventType) error
	ExecuteTask(event EventType, execTime time.Duration) error
	ExecuteFailoverTask(event EventType, execTime time.Duration) error
}

MetricUpdater increments data metric

type Storage

type Storage interface {
	MetricUpdater
	MetricReader
}

Storage data accessor for monitoring

type TaskInfo

type TaskInfo struct {
	TotalCount   uint64        `json:"total_count"`
	ErrorCount   uint64        `json:"error_count"`
	SuccessCount uint64        `json:"success_count"`
	SkipCount    uint64        `json:"skip_count"`
	MinExecTime  time.Duration `json:"min_exec_time"`
	AvgExecTime  time.Duration `json:"avg_exec_time"`
	MaxExecTime  time.Duration `json:"max_exec_time"`
	TaskNames    []string      `json:"task_names,omitempty"` // The list of finished task names
	CreatedAt    time.Time     `json:"created_at"`
	UpdatedAt    time.Time     `json:"updated_at"`
}

TaskInfo aggregated in one record

func (*TaskInfo) Add

func (task *TaskInfo) Add(info *TaskInfo)

Add task info

func (*TaskInfo) AddTaskName

func (task *TaskInfo) AddTaskName(name string)

AddTaskName to the list

func (*TaskInfo) Inc

func (task *TaskInfo) Inc(err error, execTime time.Duration)

Inc counters

func (*TaskInfo) IsInited added in v2.1.0

func (task *TaskInfo) IsInited() bool

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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