Skip to main content

Monitor

VEF includes a monitor service and a built-in resource for runtime inspection.

Module Outputs

The monitor module provides:

OutputMeaning
monitor.Serviceruntime monitoring service
sys/monitorbuilt-in RPC resource

The service is initialized and closed through lifecycle hooks when needed.

monitor.Service Interface

The public monitoring service exposes:

MethodReturn typePurpose
Overview(ctx)*monitor.SystemOverviewcombined overview snapshot
CPU(ctx)*monitor.CPUInfoCPU detail and usage
Memory(ctx)*monitor.MemoryInfovirtual and swap memory detail
Disk(ctx)*monitor.DiskInfopartitions and disk I/O detail
Network(ctx)*monitor.NetworkInfointerfaces and network I/O detail
Host(ctx)*monitor.HostInfostatic host metadata
Process(ctx)*monitor.ProcessInfocurrent process detail
Load(ctx)*monitor.LoadInfoload averages
BuildInfo()*monitor.BuildInfobuild metadata

Built-In Resource

The monitor module registers:

Resource
sys/monitor

Current actions:

ActionInput paramsOutput typeNotes
get_overviewnonemonitor.SystemOverviewoverview can contain partial data when some probes are unavailable
get_cpunonemonitor.CPUInforeturns monitor not ready when CPU sample cache is not ready
get_memorynonemonitor.MemoryInfoincludes virtual memory and swap
get_disknonemonitor.DiskInfoincludes partitions and I/O counters
get_networknonemonitor.NetworkInfoincludes interfaces and I/O counters
get_hostnonemonitor.HostInfostatic host metadata
get_processnonemonitor.ProcessInforeturns monitor not ready when process sample cache is not ready
get_loadnonemonitor.LoadInfoload averages
get_build_infononemonitor.BuildInfobuild metadata only
get_event_streamsnonemonitor.EventStreamsInforeports cross-process event stream and consumer-group state; enabled=false and an empty streams list when no event.StreamInspector is available (the redis_stream transport is off)

Implementation details visible in source:

  • each action currently sets a per-operation rate-limit max of 60
  • get_cpu and get_process use a specific monitor-not-ready business error when samples are not ready
  • get_event_streams is gated by the optional event.StreamInspector dependency; a nil inspector still returns 200 OK with enabled=false instead of failing

Error API

APIMeaning
monitor.ErrNotReady / ErrCodeNotReadysample-backed data such as CPU or process metrics is not ready yet
monitor.ErrCollectionFailed / ErrCodeCollectionFaileda monitor probe failed while collecting runtime data

Default Sampling Configuration

When no explicit monitor config is supplied, the module uses:

SettingDefault
sample interval10s
sample duration2s

These defaults primarily affect CPU and process sampling behavior.

Build Info Behavior

The monitor module decorates build info so that vefVersion is always present, even when the application does not provide a complete build metadata object.

Fallback behavior:

FieldFallback value when app does not supply build info
appVersionunknown
buildTimeunknown
gitCommitunknown
vefVersioncurrent framework version

Data Shapes

monitor.SystemOverview

FieldTypeMeaning
host*monitor.HostSummarycondensed host information
cpu*monitor.CPUSummarycondensed CPU information
memory*monitor.MemorySummarycondensed memory usage
disk*monitor.DiskSummarycondensed disk usage
network*monitor.NetworkSummarycondensed network activity
process*monitor.ProcessSummarycondensed current process metrics
load*monitor.LoadInfoload averages
build*monitor.BuildInfobuild metadata

monitor.HostSummary

FieldTypeMeaning
hostnamestringhost name
osstringoperating system
platformstringplatform name
platformVersionstringplatform version
kernelVersionstringkernel version
kernelArchstringkernel architecture
uptimeuint64uptime in seconds

monitor.HostInfo

FieldTypeMeaning
hostnamestringhost name
uptimeuint64uptime in seconds
bootTimeuint64boot timestamp
processesuint64number of processes
osstringoperating system
platformstringplatform name
platformFamilystringplatform family
platformVersionstringplatform version
kernelVersionstringkernel version
kernelArchstringkernel architecture
virtualizationSystemstringvirtualization system
virtualizationRolestringvirtualization role
hostIdstringhost identifier

monitor.CPUSummary

FieldTypeMeaning
physicalCoresintnumber of physical cores (host topology)
logicalCoresintnumber of logical cores (host topology)
usagePercentfloat64aggregated CPU usage percent, normalized by effectiveCores
effectiveCoresfloat64the capacity used to normalize utilization (v0.38): inside a container this is the cgroup CPU quota (v1 and v2 supported), falling back to logicalCores when constrained usage cannot be sampled coherently

monitor.CPUInfo

FieldTypeMeaning
physicalCoresintnumber of physical cores
logicalCoresintnumber of logical cores
modelNamestringCPU model name
mhzfloat64clock frequency
cacheSizeint32cache size
usagePercent[]float64per-core usage percentages
totalPercentfloat64total usage percent, derived from the per-core sample
vendorIdstringvendor identifier
familystringCPU family
modelstringCPU model
steppingint32CPU stepping
microcodestringmicrocode version
effectiveCoresfloat64capacity used to normalize utilization; see CPUSummary.effectiveCores (v0.38)

monitor.MemorySummary

FieldTypeMeaning
totaluint64total memory
useduint64used memory
usedPercentfloat64memory usage percentage

Since v0.38 the monitor is container-aware: when the process runs under a cgroup (v2 or v1) that actually limits memory, the headline figures (total, used, usedPercent, and VirtualMemory's available/free) reflect the cgroup limit and the cgroup's own usage instead of host-wide numbers — a 512 MiB container on a 64 GiB host reports against 512 MiB. Without a limit, host-wide figures are reported unchanged.

monitor.MemoryInfo

FieldTypeMeaning
virtual*monitor.VirtualMemoryphysical or virtual memory detail
swap*monitor.SwapMemoryswap detail

monitor.VirtualMemory

FieldTypeMeaning
totaluint64total virtual memory
availableuint64available memory
useduint64used memory
usedPercentfloat64used percentage
freeuint64free memory
activeuint64active memory
inactiveuint64inactive memory
wireduint64wired memory
laundryuint64laundry pages
buffersuint64buffer memory
cacheduint64cached memory
writeBackuint64write-back pages
dirtyuint64dirty pages
writeBackTmpuint64temporary write-back pages
shareduint64shared memory
slabuint64slab memory
slabReclaimableuint64reclaimable slab
slabUnreclaimableuint64unreclaimable slab
pageTablesuint64page table usage
swapCacheduint64cached swap
commitLimituint64commit limit
committedAsuint64committed memory
highTotaluint64high memory total
highFreeuint64high memory free
lowTotaluint64low memory total
lowFreeuint64low memory free
swapTotaluint64swap total
swapFreeuint64swap free
mappeduint64mapped memory
vmAllocTotaluint64VM allocated total
vmAllocUseduint64VM allocated used
vmAllocChunkuint64VM allocation chunk
hugePagesTotaluint64huge pages total
hugePagesFreeuint64huge pages free
hugePagesReserveduint64huge pages reserved
hugePagesSurplusuint64huge pages surplus
hugePageSizeuint64huge page size
anonHugePagesuint64anonymous huge pages

monitor.SwapMemory

FieldTypeMeaning
totaluint64total swap
useduint64used swap
freeuint64free swap
usedPercentfloat64swap usage percentage
swapInuint64swap-in count
swapOutuint64swap-out count
pageInuint64page-in count
pageOutuint64page-out count
pageFaultuint64page faults
pageMajorFaultuint64major page faults

monitor.DiskSummary

FieldTypeMeaning
totaluint64total size of the root filesystem
useduint64used size of the root filesystem
usedPercentfloat64root filesystem usage percentage
partitionsintalways 1 since v0.38

Since v0.38 the overview's disk summary reports the filesystem that bounds the process's root path instead of summing every mounted partition — remote mounts, disk images, and sibling volumes no longer inflate host capacity, and the vef.monitor.excluded_mounts config was removed with the summation. The raw mount inventory remains available through DiskInfo.partitions.

monitor.DiskInfo

FieldTypeMeaning
partitions[]*monitor.PartitionInfopartition details
ioCountersmap[string]*monitor.IOCounterper-device I/O counters

monitor.PartitionInfo

FieldTypeMeaning
devicestringdevice name
mountPointstringmount path
fsTypestringfilesystem type
options[]stringmount options
totaluint64total size
freeuint64free size
useduint64used size
usedPercentfloat64usage percentage
iNodesTotaluint64total inodes
iNodesUseduint64used inodes
iNodesFreeuint64free inodes
iNodesUsedPercentfloat64inode usage percentage

monitor.IOCounter

FieldTypeMeaning
readCountuint64read operation count
mergedReadCountuint64merged read operation count
writeCountuint64write operation count
mergedWriteCountuint64merged write operation count
readBytesuint64bytes read
writeBytesuint64bytes written
readTimeuint64read time
writeTimeuint64write time
iopsInProgressuint64I/O operations in progress
ioTimeuint64total I/O time
weightedIouint64weighted I/O time
namestringdevice name
serialNumberstringdevice serial number
labelstringdevice label

monitor.NetworkSummary

FieldTypeMeaning
interfacesintinterface count
bytesSentuint64total bytes sent
bytesRecvuint64total bytes received
packetsSentuint64total packets sent
packetsRecvuint64total packets received

monitor.NetworkInfo

FieldTypeMeaning
interfaces[]*monitor.InterfaceInfointerface metadata
ioCountersmap[string]*monitor.NetIOCounterper-interface counters

monitor.InterfaceInfo

FieldTypeMeaning
indexintinterface index
mtuintMTU
namestringinterface name
hardwareAddrstringMAC address
flags[]stringinterface flags
addrs[]stringbound addresses

monitor.NetIOCounter

FieldTypeMeaning
namestringinterface name
bytesSentuint64bytes sent
bytesRecvuint64bytes received
packetsSentuint64packets sent
packetsRecvuint64packets received
errorsInuint64inbound errors
errorsOutuint64outbound errors
droppedInuint64inbound drops
droppedOutuint64outbound drops
fifoInuint64inbound FIFO count
fifoOutuint64outbound FIFO count

monitor.ProcessSummary

FieldTypeMeaning
pidint32process ID
namestringprocess name
cpuPercentfloat64CPU usage percent
memoryPercentfloat32memory usage percent

monitor.ProcessInfo

FieldTypeMeaning
pidint32process ID
parentPidint32parent process ID
namestringprocess name
exestringexecutable path
commandLinestringfull command line
cwdstringworking directory
statusstringprocess status
usernamestringowner username
createTimeint64creation timestamp
numThreadsint32thread count
numFdsint32open file-descriptor count
cpuPercentfloat64CPU usage percent
memoryPercentfloat32memory usage percent
memoryRssuint64RSS memory
memoryVmsuint64virtual memory size
memorySwapuint64swap usage

monitor.LoadInfo

FieldTypeMeaning
load1float641-minute load average
load5float645-minute load average
load15float6415-minute load average

monitor.BuildInfo

FieldTypeMeaning
vefVersionstringframework version
appVersionstringapplication version
buildTimestringbuild time
gitCommitstringgit commit

monitor.EventStreamsInfo

FieldTypeMeaning
enabledboolwhether an event.StreamInspector is available (the redis_stream transport is on)
streams[]event.StreamInfoone entry per transport stream; empty when enabled is false

event.StreamInfo

FieldTypeMeaning
streamstringfull transport-level stream key (prefix + event type)
lengthint64current number of entries in the stream (post-trim)
groups[]event.StreamGroupInfoconsumer groups attached to the stream

event.StreamGroupInfo

FieldTypeMeaning
namestringconsumer group name (the subscription's WithGroup value or its derived default)
consumersint64number of consumer records registered in the group, including historical consumers of restarted processes
pendingint64number of delivered-but-unacknowledged entries
lagint64number of stream entries not yet delivered to this group (approximate after trimming; zero on server versions that do not report lag)
lastDeliveredIdstringstream ID of the last entry delivered to the group

A group with growing lag and only idle consumers is an orphan candidate — a subscriber that was removed or renamed without decommissioning its consumer group. See the Event Bus page for the transport-level detail.

Minimal Request Example

{
"resource": "sys/monitor",
"action": "get_overview",
"version": "v1"
}

Practical Use

  • admin or ops dashboards
  • health and diagnostics surfaces
  • internal tooling
  • build metadata exposure

Next Step

Read CLI Tools if you want generate-build-info to populate richer build metadata.