metric_reader

package
v1.1.6-next Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(metricsURL string) *readerImpl

Types

type NodeMetrics

type NodeMetrics struct {
	// cpu
	CpuCoreCount    int     `json:"cpu_core_count"`
	CpuLoadInfo     string  `json:"cpu_load_info"`
	CpuUsagePercent float64 `json:"cpu_usage_percent"`

	// memory
	MemoryTotalBytes   int64   `json:"memory_total_bytes"`
	MemoryUsageBytes   int64   `json:"memory_usage_bytes"`
	MemoryUsagePercent float64 `json:"memory_usage_percent"`

	// disk
	DiskTotalBytes   int64   `json:"disk_total_bytes"`
	DiskUsageBytes   int64   `json:"disk_usage_bytes"`
	DiskUsagePercent float64 `json:"disk_usage_percent"`

	// network
	NetworkReceiveBytesTotal  int64   `json:"network_receive_bytes_total"`
	NetworkTransmitBytesTotal int64   `json:"network_transmit_bytes_total"`
	NetworkReceiveBytesRate   float64 `json:"network_receive_bytes_rate"`
	NetworkTransmitBytesRate  float64 `json:"network_transmit_bytes_rate"`

	SyncTime time.Time
}

type PingMetric

type PingMetric struct {
	Latency int64  `json:"latency"` // in ms
	Target  string `json:"target"`
}

type Reader

type Reader interface {
	ReadOnce(ctx context.Context) (*NodeMetrics, map[string]*RuleMetrics, error)
}

type RuleMetrics added in v1.1.5

type RuleMetrics struct {
	Label string // rule label

	PingMetrics map[string]*PingMetric // key: remote

	TCPConnectionCount      map[string]int64 // key: remote
	TCPHandShakeDuration    map[string]int64 // key: remote in ms
	TCPNetworkTransmitBytes map[string]int64 // key: remote

	UDPConnectionCount      map[string]int64 // key: remote
	UDPHandShakeDuration    map[string]int64 // key: remote in ms
	UDPNetworkTransmitBytes map[string]int64 // key: remote

	SyncTime time.Time
}

Jump to

Keyboard shortcuts

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