shepherd_common

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ShepherdSshConnectTimeout = time.Second * 3

Variables

View Source
var ResTrackerCmd = "resource-tracker"

Prerequisite - install small edge-cloud utility on the VM running this docker containers

View Source
var ShepherdPlatformActive bool

Functions

func GetProxyKey

func GetProxyKey(appInstKey *edgeproto.AppInstKey) string

func ShouldRunEnvoy

func ShouldRunEnvoy(app *edgeproto.App, appInst *edgeproto.AppInst) bool

Types

type AppMetrics

type AppMetrics struct {
	// Cpu is a percentage
	Cpu   float64
	CpuTS *types.Timestamp
	// Mem is bytes used
	Mem   uint64
	MemTS *types.Timestamp
	// Disk is bytes used
	Disk   uint64
	DiskTS *types.Timestamp
}

type AppStats

type AppStats interface {
	// Returns current resource usage for a app instance
	GetAppStats(ctx context.Context) *AppMetrics
}

Common interface to deal with AppMetrics Pending EDGECLOUD-1183 implementation

type CloudletMetrics

type CloudletMetrics struct {
	CollectTime *types.Timestamp
	// Total number of CPUs
	VCpuMax uint64
	// Current number of CPUs used
	VCpuUsed uint64
	// Total amount of RAM(in MB)
	MemMax uint64
	// Currently used RAM(in MB)
	MemUsed uint64
	// Total amount of Storage(in GB)
	DiskUsed uint64
	// Currently used Storage(in GB)
	DiskMax uint64
	// Total number of Floating IPs available
	FloatingIpsMax uint64
	// Currently used number of Floating IPs
	FloatingIpsUsed uint64
	// Total KBytes received
	NetRecv uint64
	// Total KBytes sent
	NetSent uint64
	// Total available IP addresses
	Ipv4Max uint64
	// Currently used IP addrs
	Ipv4Used uint64
}

This structure represents cloudlet utilization stats It tracks the Max Available and currently used set of resources

type ClusterMetrics

type ClusterMetrics struct {
	Cpu          float64
	CpuTS        *types.Timestamp
	Mem          float64
	MemTS        *types.Timestamp
	Disk         float64
	DiskTS       *types.Timestamp
	TcpConns     uint64
	TcpConnsTS   *types.Timestamp
	TcpRetrans   uint64
	TcpRetransTS *types.Timestamp
	UdpSent      uint64
	UdpSentTS    *types.Timestamp
	UdpRecv      uint64
	UdpRecvTS    *types.Timestamp
	UdpRecvErr   uint64
	UdpRecvErrTS *types.Timestamp
	AutoScaleCpu float64
	AutoScaleMem float64
}

type ClusterNetMetrics

type ClusterNetMetrics struct {
	NetTS   *types.Timestamp
	NetSent uint64
	NetRecv uint64
}

type ClusterStats

type ClusterStats interface {
	// Returns current resource usage for a cluster instance
	GetClusterStats(ctx context.Context, ops ...StatsOp) *ClusterMetrics
	GetAppStats(ctx context.Context) map[MetricAppInstKey]*AppMetrics
	GetAlerts(ctx context.Context) []edgeproto.Alert
	// Track a new AppInst in the cluster. Must be idempotent
	TrackAppInst(ctx context.Context, appInst *edgeproto.AppInst)
	// Untrack an AppInst from the cluster. Must be idempotent
	UntrackAppInst(ctx context.Context, appInst *edgeproto.AppInst)
}

Common interface to deal with ClusterMetrics

type MetricAppInstKey

type MetricAppInstKey struct {
	ClusterKey  edgeproto.ClusterKey
	CloudletKey edgeproto.CloudletKey
	Pod         string
	AppInstName string
	AppInstOrg  string
}

We keep the name of the pod+ClusterKey rather than AppInstKey The reason is that we do not have a way to differentiate between different pods in a k8s cluster See EDGECLOUD-1183

type ProxyMetrics

type ProxyMetrics struct {
	ActiveConn    uint64
	Accepts       uint64
	HandledConn   uint64
	Requests      uint64
	Reading       uint64
	Writing       uint64
	Waiting       uint64
	Nginx         bool
	EnvoyTcpStats map[int32]TcpConnectionsMetric
	EnvoyUdpStats map[int32]UdpConnectionsMetric
	Ts            *types.Timestamp
}

type StatsOp

type StatsOp func(opts *StatsOptions)

func WithAutoScaleStats

func WithAutoScaleStats() StatsOp

type StatsOptions

type StatsOptions struct {
	GetAutoScaleStats bool
}

func GetStatsOptions

func GetStatsOptions(ops []StatsOp) *StatsOptions

type TcpConnectionsMetric

type TcpConnectionsMetric struct {
	ActiveConn  uint64
	Accepts     uint64
	HandledConn uint64
	// histogram of sessions times (in ms)
	SessionTime map[string]float64
	BytesSent   uint64
	BytesRecvd  uint64
}

type UdpConnectionsMetric

type UdpConnectionsMetric struct {
	RecvBytes     uint64
	SentBytes     uint64
	RecvDatagrams uint64
	SentDatagrams uint64
	RecvErrs      uint64
	SentErrs      uint64
	Overflow      uint64
	Missed        uint64
}

Jump to

Keyboard shortcuts

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