metrics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type AppMemory added in v0.1.2

type AppMemory struct {
	Alloc      uint64    `json:"alloc"`
	HeapAlloc  uint64    `json:"heap_alloc"`
	TotalAlloc uint64    `json:"total_alloc"`
	Sys        uint64    `json:"sys"`
	NumGC      uint64    `json:"num_gc"`
	LastGC     time.Time `json:"last_gc"`
}

type AppMemoryManager added in v0.1.2

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

func NewAppMemoryManager added in v0.1.2

func NewAppMemoryManager(publisher IPublisher) *AppMemoryManager

func (AppMemoryManager) Snapshot added in v0.1.2

func (d AppMemoryManager) Snapshot() AppMemory

type Cpu added in v0.1.2

type Cpu struct {
	Cores int64   `json:"cores"`
	Mhz   float64 `json:"mhz"`
	All   float64 `json:"all"`
}

type CpuManager added in v0.1.2

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

func NewCpuManager added in v0.1.2

func NewCpuManager(publisher IPublisher) (c *CpuManager)

func (*CpuManager) All added in v0.1.2

func (c *CpuManager) All() float64

func (*CpuManager) Snapshot added in v0.1.2

func (c *CpuManager) Snapshot() Cpu

type Device added in v0.1.2

type Device struct {
	Total    int64 `json:"total"`
	Disabled int64 `json:"disabled"`
}

type DeviceAdd added in v0.1.2

type DeviceAdd struct {
	TotalNum    int64
	DisabledNum int64
}

type DeviceDelete added in v0.1.2

type DeviceDelete struct {
	TotalNum    int64
	DisabledNum int64
}

type DeviceManager added in v0.1.2

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

func NewDeviceManager added in v0.1.2

func NewDeviceManager(publisher IPublisher) *DeviceManager

func (*DeviceManager) Snapshot added in v0.1.2

func (d *DeviceManager) Snapshot() Device

type Disk added in v0.1.2

type Disk struct {
	Root UsageStat `json:"root"`
}

type DiskManager added in v0.1.2

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

func NewDiskManager added in v0.1.2

func NewDiskManager(publisher IPublisher) (manager *DiskManager)

func (*DiskManager) Snapshot added in v0.1.2

func (d *DiskManager) Snapshot() Disk

type Flow added in v0.1.2

type Flow struct {
	Total    int64 `json:"total"`
	Disabled int64 `json:"disabled"`
}

type FlowAdd added in v0.1.2

type FlowAdd struct {
	TotalNum   int64
	EnabledNum int64
}

type FlowDelete added in v0.1.2

type FlowDelete struct {
	TotalNum   int64
	EnabledNum int64
}

type FlowManager added in v0.1.2

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

func NewFlowManager added in v0.1.2

func NewFlowManager(publisher IPublisher,
	adaptors *adaptors.Adaptors) (flow *FlowManager)

func (*FlowManager) Snapshot added in v0.1.2

func (d *FlowManager) Snapshot() Flow

type Gate added in v0.1.2

type Gate struct {
	Status      string `json:"status"`
	AccessToken string `json:"access_token"`
}

type GateManager added in v0.1.2

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

func NewGateManager added in v0.1.2

func NewGateManager(publisher IPublisher) *GateManager

func (*GateManager) Snapshot added in v0.1.2

func (d *GateManager) Snapshot() Gate

type GateUpdate added in v0.1.2

type GateUpdate struct {
	Status, AccessToken string
}

type History added in v0.2.0

type History struct {
	Items []HistoryItem `json:"items"`
}

type HistoryItem added in v0.2.0

type HistoryItem struct {
	DeviceName        string    `json:"device_name"`
	DeviceDescription string    `json:"device_description"`
	Type              string    `json:"type"`
	LogLevel          string    `json:"log_level"`
	Description       string    `json:"description"`
	CreatedAt         time.Time `json:"created_at"`
}

type HistoryManager added in v0.2.0

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

func NewHistoryManager added in v0.2.0

func NewHistoryManager(publisher IPublisher, adaptors *adaptors.Adaptors) *HistoryManager

func (HistoryManager) Snapshot added in v0.2.0

func (d HistoryManager) Snapshot() History

type IPublisher added in v0.1.2

type IPublisher interface {
	Broadcast(interface{})
}

type ISubscriber added in v0.1.2

type ISubscriber interface {
	Broadcast(interface{})
}

type MapElement added in v0.1.2

type MapElement struct {
	Total    int64                      `json:"total"`
	Elements map[string]MapElementState `json:"devices"`
}

type MapElementAdd added in v0.1.2

type MapElementAdd struct {
	Num int64
}

type MapElementCursor added in v0.1.2

type MapElementCursor struct {
	DeviceId    int64
	ElementName string
}

type MapElementDelete added in v0.1.2

type MapElementDelete struct {
	Num int64
}

type MapElementManager added in v0.1.2

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

func NewMapElementManager added in v0.1.2

func NewMapElementManager(publisher IPublisher) *MapElementManager

func (*MapElementManager) Snapshot added in v0.1.2

func (d *MapElementManager) Snapshot() MapElement

type MapElementSetOption added in v0.1.2

type MapElementSetOption struct {
	DeviceId     int64       `json:"device_id"`
	ElementName  string      `json:"element_name"`
	StateId      int64       `json:"state_id"`
	StateOptions interface{} `json:"state_options"`
}

type MapElementSetState added in v0.1.2

type MapElementSetState struct {
	DeviceId    int64  `json:"device_id"`
	ElementName string `json:"element_name"`
	StateId     int64  `json:"state_id"`
}

type MapElementState added in v0.1.2

type MapElementState struct {
	DeviceId     int64       `json:"device_id"`
	ElementName  string      `json:"element_name"`
	StateId      int64       `json:"state_id"`
	StateOptions interface{} `json:"state_options"`
}

type Memory added in v0.1.2

type Memory struct {
	SwapTotal uint64 `json:"swap_total"`
	SwapFree  uint64 `json:"swap_free"`
	MemTotal  uint64 `json:"mem_total"`
	MemFree   uint64 `json:"mem_free"`
}

type MemoryManager added in v0.1.2

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

func NewMemoryManager added in v0.1.2

func NewMemoryManager(publisher IPublisher) *MemoryManager

func (*MemoryManager) Snapshot added in v0.1.2

func (d *MemoryManager) Snapshot() Memory

type MetricConfig

type MetricConfig struct {
	RunMode config.RunMode
	Host    string
	Port    int
}

func NewMetricConfig

func NewMetricConfig(cfg *config.AppConfig) *MetricConfig

type MetricManager added in v0.1.2

type MetricManager struct {
	*Publisher

	Cpu         *CpuManager
	Disk        *DiskManager
	Uptime      *UptimeManager
	Memory      *MemoryManager
	Gate        *GateManager
	Workflow    *WorkflowManager
	Node        *NodeManager
	Device      *DeviceManager
	MapElement  *MapElementManager
	Flow        *FlowManager
	AppMemory   *AppMemoryManager
	Mqtt        *MqttManager
	Zigbee2Mqtt *Zigbee2MqttManager
	History     *HistoryManager
	// contains filtered or unexported fields
}

func NewMetricManager added in v0.1.2

func NewMetricManager(cfg *MetricConfig,
	graceful *graceful_service.GracefulService,
	adaptors *adaptors.Adaptors) *MetricManager

func (MetricManager) Shutdown added in v0.1.2

func (m MetricManager) Shutdown()

func (*MetricManager) Start added in v0.1.2

func (m *MetricManager) Start()

func (*MetricManager) Update added in v0.1.2

func (m *MetricManager) Update(t interface{})

type Mqtt added in v0.1.2

type Mqtt struct {
	ClientState MqttClientStats `json:"client_state"`
}

type MqttClientStats added in v0.1.2

type MqttClientStats struct {
	ConnectedTotal    uint64 `json:"connected_total"`
	DisconnectedTotal uint64 `json:"disconnected_total"`
	ActiveCurrent     uint64 `json:"active_current"`
	InactiveCurrent   uint64 `json:"inactive_current"`
	ExpiredTotal      uint64 `json:"expired_total"`
}

type MqttManager added in v0.1.2

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

func NewMqttManager added in v0.1.2

func NewMqttManager(publisher IPublisher) *MqttManager

func (*MqttManager) Snapshot added in v0.1.2

func (d *MqttManager) Snapshot() Mqtt

type Node added in v0.1.2

type Node struct {
	Total  int64            `json:"total"`
	Status map[int64]string `json:"status"`
}

type NodeAdd added in v0.1.2

type NodeAdd struct {
	Num int64
}

type NodeDelete added in v0.1.2

type NodeDelete struct {
	Num int64
}

type NodeManager added in v0.1.2

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

func NewNodeManager added in v0.1.2

func NewNodeManager(publisher IPublisher) *NodeManager

func (*NodeManager) GetStatus added in v0.1.2

func (d *NodeManager) GetStatus(nodeId int64) (status string, err error)

func (*NodeManager) Snapshot added in v0.1.2

func (d *NodeManager) Snapshot() Node

type NodeUpdateStatus added in v0.1.2

type NodeUpdateStatus struct {
	Id     int64
	Status string
}

type Publisher added in v0.1.2

type Publisher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPublisher added in v0.1.2

func NewPublisher() (t *Publisher)

func (*Publisher) Broadcast added in v0.1.2

func (p *Publisher) Broadcast(param interface{})

func (*Publisher) Subscribe added in v0.1.2

func (p *Publisher) Subscribe(command string, f ISubscriber)

func (*Publisher) UnSubscribe added in v0.1.2

func (p *Publisher) UnSubscribe(command string)

type Uptime added in v0.1.2

type Uptime struct {
	Total      uint64    `json:"total"`
	AppStarted time.Time `json:"app_started"`
}

type UptimeManager added in v0.1.2

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

func NewUptimeManager added in v0.1.2

func NewUptimeManager(publisher IPublisher) (uptime *UptimeManager)

func (*UptimeManager) Snapshot added in v0.1.2

func (d *UptimeManager) Snapshot() Uptime

type UsageStat added in v0.1.2

type UsageStat struct {
	Path              string  `json:"path"`
	Fstype            string  `json:"fstype"`
	Total             uint64  `json:"total"`
	Free              uint64  `json:"free"`
	Used              uint64  `json:"used"`
	UsedPercent       float64 `json:"used_percent"`
	InodesTotal       uint64  `json:"inodes_total"`
	InodesUsed        uint64  `json:"inodes_used"`
	InodesFree        uint64  `json:"inodes_free"`
	InodesUsedPercent float64 `json:"inodes_used_percent"`
}

type Workflow added in v0.1.2

type Workflow struct {
	Total    int64                    `json:"total"`
	Disabled int64                    `json:"disabled"`
	Status   map[int64]WorkflowStatus `json:"status"`
}

type WorkflowAdd added in v0.1.2

type WorkflowAdd struct {
	TotalNum   int64
	EnabledNum int64
}

type WorkflowDelete added in v0.1.2

type WorkflowDelete struct {
	TotalNum   int64
	EnabledNum int64
}

type WorkflowManager added in v0.1.2

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

func NewWorkflowManager added in v0.1.2

func NewWorkflowManager(publisher IPublisher,
	adaptors *adaptors.Adaptors) (wf *WorkflowManager)

func (*WorkflowManager) GetStatus added in v0.1.2

func (d *WorkflowManager) GetStatus(workflowId int64) (status WorkflowStatus, err error)

func (*WorkflowManager) Snapshot added in v0.1.2

func (d *WorkflowManager) Snapshot() Workflow

type WorkflowStatus added in v0.1.2

type WorkflowStatus struct {
	Id         int64 `json:"id"`
	ScenarioId int64 `json:"scenario_id"`
}

type WorkflowUpdateScenario added in v0.1.2

type WorkflowUpdateScenario struct {
	Id         int64
	ScenarioId int64
}

type Zigbee2Mqtt added in v0.1.2

type Zigbee2Mqtt struct {
	Total    int64 `json:"total"`
	Disabled int64 `json:"disabled"`
}

type Zigbee2MqttAdd added in v0.1.2

type Zigbee2MqttAdd struct {
	TotalNum    int64
	DisabledNum int64
}

type Zigbee2MqttDelete added in v0.1.2

type Zigbee2MqttDelete struct {
	TotalNum    int64
	DisabledNum int64
}

type Zigbee2MqttManager added in v0.1.2

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

func NewZigbee2MqttManager added in v0.1.2

func NewZigbee2MqttManager(publisher IPublisher) *Zigbee2MqttManager

func (*Zigbee2MqttManager) Snapshot added in v0.1.2

func (d *Zigbee2MqttManager) Snapshot() Zigbee2Mqtt

type Zigbee2MqttUpdate added in v0.2.0

type Zigbee2MqttUpdate struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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