Documentation ¶
Index ¶
- Constants
- func GetPodStatsById(stats []stats.PodStats, podId string) *stats.PodStats
- func Init(csp stats.ContainerStatsProvider)
- func Start()
- func Stop()
- type ContainerCpuMetric
- type ContainerMemoryMetric
- type ContainerMetricMeta
- type ContainerMetrics
- type CpuMetric
- type DiskIOMeta
- type DiskIOMetric
- type GuestMetrics
- type MemMetric
- type NetIOMetric
- type NetMeta
- type PodCpuMetric
- type PodMemoryMetric
- type PodMetricMeta
- type PodMetrics
- type SGuestMonitor
- func (m *SGuestMonitor) Cpu() *CpuMetric
- func (m *SGuestMonitor) Diskio() *DiskIOMetric
- func (m *SGuestMonitor) GetSriovNicStats(pfName string, virtfn int) (*psnet.IOCountersStat, error)
- func (m *SGuestMonitor) HasPodMetrics() bool
- func (m *SGuestMonitor) Mem() *MemMetric
- func (m *SGuestMonitor) Netio() []*NetIOMetric
- func (m *SGuestMonitor) PodMetrics(prevUsage *GuestMetrics) *PodMetrics
- func (m *SGuestMonitor) SetNicDown(index int)
- func (m *SGuestMonitor) UpdateByInstance(instance guestman.GuestRuntimeInstance)
- func (m *SGuestMonitor) UpdateCpuCount(vcpuCount int)
- func (m *SGuestMonitor) UpdateNicsDesc(nics []*desc.SGuestNetwork)
- func (m *SGuestMonitor) UpdateVmName(name string)
- type SGuestMonitorCollector
- type SHostMetricsCollector
Constants ¶
View Source
const ( // Cumulative cpu time consumed by the container in core-seconds CPU_USAGE_SECONDS_TOTAL = "usage_seconds_total" // cpu usage rate CPU_USAGE_RATE = "usage_rate" // current working set of memory size in bytes MEMORY_WORKING_SET_BYTES = "working_set_bytes" // memory usage rate MEMORY_USAGE_RATE = "usage_rate" )
View Source
const (
TelegrafServer = "http://127.0.0.1:8087/write"
)
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(csp stats.ContainerStatsProvider)
Types ¶
type ContainerCpuMetric ¶
type ContainerCpuMetric struct { ContainerMetricMeta CpuUsageSecondsTotal float64 `json:"cpu_usage_seconds_total"` CpuUsageRate *float64 `json:"cpu_usage_rate"` }
func (ContainerCpuMetric) GetName ¶
func (m ContainerCpuMetric) GetName() string
func (*ContainerCpuMetric) ToMap ¶
func (m *ContainerCpuMetric) ToMap() map[string]interface{}
type ContainerMemoryMetric ¶
type ContainerMemoryMetric struct { ContainerMetricMeta MemoryWorkingSetBytes float64 `json:"memory_working_set_bytes"` MemoryUsageRate float64 `json:"memory_usage_rate"` }
func (ContainerMemoryMetric) GetName ¶
func (m ContainerMemoryMetric) GetName() string
func (*ContainerMemoryMetric) ToMap ¶
func (m *ContainerMemoryMetric) ToMap() map[string]interface{}
type ContainerMetricMeta ¶
type ContainerMetricMeta struct { PodMetricMeta ContainerId string `json:"container_id"` ContainerName string `json:"container_name"` PodId string `json:"pod_id"` }
func NewContainerMetricMeta ¶
func (ContainerMetricMeta) GetTag ¶
func (m ContainerMetricMeta) GetTag() map[string]string
type ContainerMetrics ¶
type ContainerMetrics struct { ContainerCpu *ContainerCpuMetric `json:"container_cpu"` ContainerMemory *ContainerMemoryMetric `json:"container_memory"` }
type CpuMetric ¶
type CpuMetric struct { UsageActive float64 `json:"usage_active"` CpuUsageIdlePcore float64 `json:"cpu_usage_idle_pcore"` CpuUsagePcore float64 `json:"cpu_usage_pcore"` CpuTimeUser float64 `json:"cpu_time_user"` CpuTimeSystem float64 `json:"cpu_time_system"` CpuCount int `json:"cpu_count"` ThreadCount int32 `json:"thread_count"` }
type DiskIOMeta ¶
type DiskIOMeta struct {
Uptime uint64 `json:"uptime"`
}
type DiskIOMetric ¶
type DiskIOMetric struct { Meta DiskIOMeta `json:"-"` ReadBytes uint64 `json:"read_bytes"` WriteBytes uint64 `json:"write_bytes"` ReadCount uint64 `json:"read_count"` WriteCount uint64 `json:"write_count"` // calculated on guest metrics report ReadBps float64 `json:"read_Bps"` WriteBps float64 `json:"write_Bps"` ReadBPS float64 `json:"read_bps"` WriteBPS float64 `json:"write_bps"` ReadIOPS float64 `json:"read_iops"` WriteIOPS float64 `json:"write_iops"` }
func (*DiskIOMetric) ToMap ¶
func (d *DiskIOMetric) ToMap() map[string]interface{}
type GuestMetrics ¶
type GuestMetrics struct { VmCpu *CpuMetric `json:"vm_cpu"` VmMem *MemMetric `json:"vm_mem"` VmNetio []*NetIOMetric `json:"vm_netio"` VmDiskio *DiskIOMetric `json:"vm_diskio"` PodMetrics *PodMetrics `json:"pod_metrics"` }
type MemMetric ¶
type NetIOMetric ¶
type NetIOMetric struct { Meta NetMeta `json:"-"` BytesSent uint64 `json:"bytes_sent"` BytesRecv uint64 `json:"bytes_recv"` PacketsSent uint64 `json:"packets_sent"` PacketsRecv uint64 `json:"packets_recv"` ErrIn uint64 `json:"err_in"` ErrOut uint64 `json:"err_out"` DropIn uint64 `json:"drop_in"` DropOut uint64 `json:"drop_out"` // calculated on guest metrics report BPSRecv float64 `json:"bps_recv"` BPSSent float64 `json:"bps_sent"` PPSRecv float64 `json:"pps_recv"` PPSSent float64 `json:"pps_sent"` TimeDiff float64 `json:"-"` }
func (*NetIOMetric) ToMap ¶
func (n *NetIOMetric) ToMap() map[string]interface{}
func (*NetIOMetric) ToTag ¶
func (n *NetIOMetric) ToTag() map[string]string
type PodCpuMetric ¶
type PodCpuMetric struct { PodMetricMeta CpuUsageSecondsTotal float64 `json:"cpu_usage_seconds_total"` CpuUsageRate *float64 `json:"cpu_usage_rate"` }
func (PodCpuMetric) GetName ¶
func (m PodCpuMetric) GetName() string
func (PodCpuMetric) ToMap ¶
func (m PodCpuMetric) ToMap() map[string]interface{}
type PodMemoryMetric ¶
type PodMemoryMetric struct { PodMetricMeta MemoryWorkingSetBytes float64 `json:"memory_working_set_bytes"` MemoryUsageRate float64 `json:"memory_usage_rate"` }
func (PodMemoryMetric) GetName ¶
func (m PodMemoryMetric) GetName() string
func (PodMemoryMetric) ToMap ¶
func (m PodMemoryMetric) ToMap() map[string]interface{}
type PodMetricMeta ¶
func NewPodMetricMeta ¶
func NewPodMetricMeta(time time.Time) PodMetricMeta
func (PodMetricMeta) GetTag ¶
func (m PodMetricMeta) GetTag() map[string]string
type PodMetrics ¶
type PodMetrics struct { PodCpu *PodCpuMetric `json:"pod_cpu"` PodMemory *PodMemoryMetric `json:"pod_memory"` Containers []*ContainerMetrics `json:"containers"` }
type SGuestMonitor ¶
type SGuestMonitor struct { Name string Id string Pid int Nics []*desc.SGuestNetwork CpuCnt int MemMB int64 Ip string Process *process.Process ScalingGroupId string Tenant string TenantId string DomainId string ProjectDomain string // contains filtered or unexported fields }
func NewGuestMonitor ¶
func NewGuestMonitor(name, id string, pid int, nics []*desc.SGuestNetwork, cpuCount int) (*SGuestMonitor, error)
func NewGuestPodMonitor ¶
func NewGuestPodMonitor(name, id string, stat *stats.PodStats, nics []*desc.SGuestNetwork, cpuCount int) (*SGuestMonitor, error)
func (*SGuestMonitor) Cpu ¶
func (m *SGuestMonitor) Cpu() *CpuMetric
func (*SGuestMonitor) Diskio ¶
func (m *SGuestMonitor) Diskio() *DiskIOMetric
func (*SGuestMonitor) GetSriovNicStats ¶
func (m *SGuestMonitor) GetSriovNicStats(pfName string, virtfn int) (*psnet.IOCountersStat, error)
func (*SGuestMonitor) HasPodMetrics ¶
func (m *SGuestMonitor) HasPodMetrics() bool
func (*SGuestMonitor) Mem ¶
func (m *SGuestMonitor) Mem() *MemMetric
func (*SGuestMonitor) Netio ¶
func (m *SGuestMonitor) Netio() []*NetIOMetric
func (*SGuestMonitor) PodMetrics ¶
func (m *SGuestMonitor) PodMetrics(prevUsage *GuestMetrics) *PodMetrics
func (*SGuestMonitor) SetNicDown ¶
func (m *SGuestMonitor) SetNicDown(index int)
func (*SGuestMonitor) UpdateByInstance ¶
func (m *SGuestMonitor) UpdateByInstance(instance guestman.GuestRuntimeInstance)
func (*SGuestMonitor) UpdateCpuCount ¶
func (m *SGuestMonitor) UpdateCpuCount(vcpuCount int)
func (*SGuestMonitor) UpdateNicsDesc ¶
func (m *SGuestMonitor) UpdateNicsDesc(nics []*desc.SGuestNetwork)
func (*SGuestMonitor) UpdateVmName ¶
func (m *SGuestMonitor) UpdateVmName(name string)
type SGuestMonitorCollector ¶
type SGuestMonitorCollector struct {
// contains filtered or unexported fields
}
func NewGuestMonitorCollector ¶
func NewGuestMonitorCollector(csp stats.ContainerStatsProvider) *SGuestMonitorCollector
func (*SGuestMonitorCollector) CollectReportData ¶
func (s *SGuestMonitorCollector) CollectReportData() (ret string)
func (*SGuestMonitorCollector) GetGuests ¶
func (s *SGuestMonitorCollector) GetGuests() map[string]*SGuestMonitor
type SHostMetricsCollector ¶
type SHostMetricsCollector struct { ReportInterval int // seconds LastCollectTime time.Time // contains filtered or unexported fields }
func NewHostMetricsCollector ¶
func NewHostMetricsCollector(csp stats.ContainerStatsProvider) *SHostMetricsCollector
func (*SHostMetricsCollector) Start ¶
func (m *SHostMetricsCollector) Start()
func (*SHostMetricsCollector) Stop ¶
func (m *SHostMetricsCollector) Stop()
Click to show internal directories.
Click to hide internal directories.