monitor

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 4 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 added in v0.3.0

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 added in v0.3.0

func NewErrorEvent(err error) EventType

NewErrorEvent returns new type event with error

func WrapEventWithName added in v0.3.0

func WrapEventWithName(name string, event EventType) EventType

WrapEventWithName returns new wrapped event

type MetricReader added in v0.2.1

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

MetricReader of information

type MetricUpdater added in v0.2.1

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
	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 added in v0.3.0

func (task *TaskInfo) AddTaskName(name string)

AddTaskName to the list

func (*TaskInfo) Inc

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

Inc counters

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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