Statsmanager Go-API
statsmanager
Section titled “statsmanager”import "givc/modules/pkgs/statsmanager"SPDX-FileCopyrightText: 2024-2026 TII (SSRC) and the Ghaf contributors SPDX-License-Identifier: Apache-2.0
The statsmanager package provides functionality to manage and retrieve system statistics.
- type StatFields
- type StatPidFields
- type StatsController
- func NewController() (*StatsController, error)
- func (c *StatsController) GetLoadStats(ctx context.Context) (*stats_api.LoadStats, error)
- func (c *StatsController) GetMemoryStats(ctx context.Context) (*stats_api.MemoryStats, error)
- func (c *StatsController) GetProcessStats(ctx context.Context) (*stats_api.ProcessStats, error)
- type StatsServer
- type process
type StatFields
Section titled “type StatFields”type StatFields intconst ( SysUserTime StatFields = iota SysNiceTime SysSystemTime SysIdleTime SysIoWaitTime SysIrq SysSoftIrq SysSteal SysGuest SysGuestNice)type StatPidFields
Section titled “type StatPidFields”type StatPidFields intconst ( ProcParentPid StatPidFields = iota ProcProcessGroup ProcSessionId ProcTtyNumber ProcTtyProcGroup ProcFlags ProcMinorFaults ProcChildMinorFaults ProcMajorFaults ProcChildMajorFaults ProcUserTime ProcSysTime ProcChildUserTime ProcChildSysTime ProcPriority ProcNice ProcNumThreads ProcJiffiesToAlrm ProcStartTime ProcVmSize ProcResidentSetSize)type StatsController
Section titled “type StatsController”type StatsController struct { jiffies uint64 processes map[uint64]process totals []uint64}func NewController
Section titled “func NewController”func NewController() (*StatsController, error)func (*StatsController) GetLoadStats
Section titled “func (*StatsController) GetLoadStats”func (c *StatsController) GetLoadStats(ctx context.Context) (*stats_api.LoadStats, error)GetLoadStats retrieves load statistics from the system.
func (*StatsController) GetMemoryStats
Section titled “func (*StatsController) GetMemoryStats”func (c *StatsController) GetMemoryStats(ctx context.Context) (*stats_api.MemoryStats, error)GetMemoryStats retrieves memory statistics from the system.
func (*StatsController) GetProcessStats
Section titled “func (*StatsController) GetProcessStats”func (c *StatsController) GetProcessStats(ctx context.Context) (*stats_api.ProcessStats, error)GetProcessStats retrieves process statistics from the system.
type StatsServer
Section titled “type StatsServer”type StatsServer struct { Controller *StatsController stats_api.UnimplementedStatsServiceServer}func NewStatsServer
Section titled “func NewStatsServer”func NewStatsServer() (*StatsServer, error)NewStatsServer creates a new instance of StatsServer with the provided service whitelist and applications.
func (*StatsServer) GetStats
Section titled “func (*StatsServer) GetStats”func (s *StatsServer) GetStats(ctx context.Context, req *stats_api.StatsRequest) (*stats_api.StatsResponse, error)GetStats handles incoming requests for system statistics.
func (*StatsServer) Name
Section titled “func (*StatsServer) Name”func (s *StatsServer) Name() stringfunc (*StatsServer) RegisterGrpcService
Section titled “func (*StatsServer) RegisterGrpcService”func (s *StatsServer) RegisterGrpcService(srv *grpc.Server)type process
Section titled “type process”type process struct { name string state string values []uint64}Generated by gomarkdoc