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.SystemOverview, error)combined overview snapshot
CPU(ctx)(*monitor.CPUInfo, error)CPU detail and usage
Memory(ctx)(*monitor.MemoryInfo, error)virtual and swap memory detail
Disk(ctx)(*monitor.DiskInfo, error)partitions and disk I/O detail
Network(ctx)(*monitor.NetworkInfo, error)interfaces and network I/O detail
Host(ctx)(*monitor.HostInfo, error)static host metadata
Process(ctx)(*monitor.ProcessInfo, error)current process detail
Load(ctx)(*monitor.LoadInfo, error)load averages
BuildInfo()*monitor.BuildInfobuild metadata (no error)

Built-In Resource

The monitor module registers the sys/monitor RPC resource, mounted under /api with the standard envelope (resource, action, version, params, meta). No operation is public and none declares a dedicated permission token: every action inherits the API engine's default Bearer authentication.

Every action sets a custom per-operation rate limit of Max: 60. The window length is not overridden, so it inherits vef.api.rate_limit.period (default 5m); the limiter counts per operation + client IP + principal, in process memory on each node.

None of the actions define framework-level input parameters: params is ignored and may be omitted entirely.

ActionAccessRate limitInputOutput
get_overviewBearer authMax: 60nonemonitor.SystemOverview
get_cpuBearer authMax: 60nonemonitor.CPUInfo
get_memoryBearer authMax: 60nonemonitor.MemoryInfo
get_diskBearer authMax: 60nonemonitor.DiskInfo
get_networkBearer authMax: 60nonemonitor.NetworkInfo
get_hostBearer authMax: 60nonemonitor.HostInfo
get_processBearer authMax: 60nonemonitor.ProcessInfo
get_loadBearer authMax: 60nonemonitor.LoadInfo
get_build_infoBearer authMax: 60nonemonitor.BuildInfo
get_event_streamsBearer authMax: 60nonemonitor.EventStreamsInfo
get_integration_statsBearer authMax: 60nonemonitor.IntegrationStatsInfo

Behavior visible in source:

  • get_overview is best-effort and never fails as a whole: a sub-probe that errors is logged and its overview field is left null, so one broken collector does not mask the rest.
  • get_cpu and get_process are served from the background sample cache and return the monitor-not-ready business error (monitor.ErrNotReady) until the first sample lands.
  • get_memory, get_disk, get_network, get_host, and get_load read live probes; a probe failure maps to monitor.ErrCollectionFailed.
  • get_build_info cannot fail: the service always holds a non-nil build-info object (see Build Info Behavior).
  • get_event_streams is gated by the optional event.StreamInspector dependency. A nil inspector (the redis_stream transport is off) still returns 200 OK with enabled: false and an empty streams list instead of failing; an inspector read error maps to monitor.ErrCollectionFailed.
  • get_integration_stats mirrors the same degradation over the optional integration.StatsInspector (nil when the integration module is off): enabled: false with an empty stats list. Reading the in-memory snapshot itself cannot fail.
  • business errors ride the standard result envelope: the HTTP status stays 200 and the failure is carried by the body code.

Error API

APIMeaning
monitor.ErrNotReady / ErrCodeNotReady (2100)sample-backed data such as CPU or process metrics is not ready yet
monitor.ErrCollectionFailed / ErrCodeCollectionFailed (2101)a monitor probe failed while collecting runtime data

Default Sampling Configuration

Defaults apply per unset field (a partial config only overrides the fields it sets):

SettingDefault
vef.monitor.sample_interval10s
vef.monitor.sample_duration2s

These settings drive the background sampler behind get_cpu and get_process: a sample is taken immediately at startup and then once per sample interval, and each sample measures utilization over one sample-duration window. Until the first sample completes (roughly the first window after startup), both actions answer with monitor.ErrNotReady.

Build Info Behavior

The service constructor normalizes 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

Responses by Action

Field names below are the JSON wire names (the Go structs' json tags). Byte quantities are plain byte counts, percentages range 0100, and counters are cumulative since boot unless noted otherwise. Fields a platform does not expose are reported as 0 or empty.

get_overviewmonitor.SystemOverview

One combined snapshot assembled from every probe. Each field is null when its probe failed; build is always present.

FieldTypeDescription
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 (same shape as get_load)
build*monitor.BuildInfobuild metadata (same shape as get_build_info)

monitor.HostSummary

FieldTypeDescription
hostnamestringhost name
osstringoperating system
platformstringplatform name
platformVersionstringplatform version
kernelVersionstringkernel version
kernelArchstringkernel architecture
uptimeuint64host uptime in seconds

monitor.CPUSummary

FieldTypeDescription
physicalCoresintnumber of physical cores (host topology)
logicalCoresintnumber of logical cores (host topology)
usagePercentfloat64aggregated CPU usage percent over the last sampling window, normalized by effectiveCores
effectiveCoresfloat64the capacity used to normalize utilization: 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.MemorySummary

FieldTypeDescription
totaluint64total memory in bytes
useduint64used memory in bytes
usedPercentfloat64memory usage percentage

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.DiskSummary

FieldTypeDescription
totaluint64total size of the root filesystem in bytes
useduint64used size of the root filesystem in bytes
usedPercentfloat64root filesystem usage percentage
partitionsintalways 1 (the summary covers a single filesystem)

The overview's disk summary reports the filesystem that bounds the process's root path rather than summing every mounted partition — remote mounts, disk images, and sibling volumes do not inflate host capacity, and there is no vef.monitor.excluded_mounts config (nothing is summed, so nothing needs excluding). The raw mount inventory remains available through DiskInfo.partitions.

monitor.NetworkSummary

FieldTypeDescription
interfacesintinterface count
bytesSentuint64total bytes sent, summed across interfaces
bytesRecvuint64total bytes received, summed across interfaces
packetsSentuint64total packets sent, summed across interfaces
packetsRecvuint64total packets received, summed across interfaces

monitor.ProcessSummary

FieldTypeDescription
pidint32process ID
namestringprocess name
cpuPercentfloat64process CPU usage percent over the last sampling window; expressed against one CPU, so it can exceed 100 on multi-core hosts
memoryPercentfloat32share of total host RAM used by the process, percent

get_cpumonitor.CPUInfo

Served from the background sample cache: refreshed once per sample interval (default 10s), each refresh measuring one sample-duration window (default 2s). Inventory fields (modelName, vendorId, family, model, stepping, microcode, mhz, cacheSize) describe the first CPU package.

FieldTypeDescription
physicalCoresintnumber of physical cores (host topology)
logicalCoresintnumber of logical cores (host topology)
modelNamestringCPU model name
mhzfloat64nominal clock frequency in MHz
cacheSizeint32cache size in KB
usagePercent[]float64per-core busy percentage over the sampling window, one entry per logical core; null inside a CPU-limited container (the cgroup measurement replaces the per-core sample)
totalPercentfloat64aggregate usage percent: the mean of the per-core sample, or — inside a CPU-limited container — the share of the cgroup capacity consumed over the window, capped at 100
vendorIdstringvendor identifier
familystringCPU family
modelstringCPU model
steppingint32CPU stepping
microcodestringmicrocode version
effectiveCoresfloat64capacity used to normalize utilization; see CPUSummary.effectiveCores

get_memorymonitor.MemoryInfo

Read live on every call. The container-aware headline behavior described under MemorySummary applies to virtual as well.

FieldTypeDescription
virtual*monitor.VirtualMemoryphysical or virtual memory detail
swap*monitor.SwapMemoryswap detail; null when the swap probe fails

monitor.VirtualMemory

All fields are byte quantities except usedPercent (percent) and the huge-page counters: hugePagesTotal, hugePagesFree, hugePagesReserved, and hugePagesSurplus are page counts, while hugePageSize and anonHugePages are bytes. Detail fields keep their host meaning even inside a memory-limited container.

FieldTypeDescription
totaluint64total 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 (count)
hugePagesFreeuint64huge pages free (count)
hugePagesReserveduint64huge pages reserved (count)
hugePagesSurplusuint64huge pages surplus (count)
hugePageSizeuint64huge page size in bytes
anonHugePagesuint64anonymous huge pages in bytes

monitor.SwapMemory

total, used, and free are bytes. swapIn, swapOut, pageIn, and pageOut are cumulative byte volumes converted from kernel page counters; pageFault and pageMajorFault are cumulative event counts.

FieldTypeDescription
totaluint64total swap
useduint64used swap
freeuint64free swap
usedPercentfloat64swap usage percentage
swapInuint64swapped-in volume
swapOutuint64swapped-out volume
pageInuint64paged-in volume
pageOutuint64paged-out volume
pageFaultuint64page faults
pageMajorFaultuint64major page faults

get_diskmonitor.DiskInfo

Read live on every call. A partition whose usage probe fails is skipped from partitions; ioCounters is null when the I/O counter probe fails.

FieldTypeDescription
partitions[]*monitor.PartitionInfoper-mount partition details
ioCountersmap[string]*monitor.IOCounterper-device I/O counters, keyed by device name

monitor.PartitionInfo

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

monitor.IOCounter

Counters are cumulative since boot; readTime, writeTime, ioTime, and weightedIo are milliseconds.

FieldTypeDescription
readCountuint64read operation count
mergedReadCountuint64merged read operation count
writeCountuint64write operation count
mergedWriteCountuint64merged write operation count
readBytesuint64bytes read
writeBytesuint64bytes written
readTimeuint64time spent reading
writeTimeuint64time spent writing
iopsInProgressuint64I/O operations in progress
ioTimeuint64total time spent on I/O
weightedIouint64weighted I/O time
namestringdevice name
serialNumberstringdevice serial number
labelstringdevice label

get_networkmonitor.NetworkInfo

Read live on every call.

FieldTypeDescription
interfaces[]*monitor.InterfaceInfointerface metadata
ioCountersmap[string]*monitor.NetIOCounterper-interface counters, keyed by interface name

monitor.InterfaceInfo

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

monitor.NetIOCounter

Counters are cumulative since boot, per interface.

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

get_hostmonitor.HostInfo

Static host metadata, read live on every call.

FieldTypeDescription
hostnamestringhost name
uptimeuint64host uptime in seconds
bootTimeuint64boot time as a Unix timestamp (seconds)
processesuint64number of processes on the host
osstringoperating system
platformstringplatform name
platformFamilystringplatform family
platformVersionstringplatform version
kernelVersionstringkernel version
kernelArchstringkernel architecture
virtualizationSystemstringvirtualization system
virtualizationRolestringvirtualization role
hostIdstringhost identifier

get_processmonitor.ProcessInfo

Describes the application's own process. Served from the background sample cache on the same cadence as get_cpu.

FieldTypeDescription
pidint32process ID
parentPidint32parent process ID
namestringprocess name
exestringexecutable path
commandLinestringfull command line
cwdstringworking directory
statusstringprocess status
usernamestringowner username
createTimeint64process creation time, milliseconds since the Unix epoch (UTC)
numThreadsint32thread count
numFdsint32open file-descriptor count
cpuPercentfloat64process CPU usage percent over the sampling window; expressed against one CPU, so it can exceed 100 on multi-core hosts
memoryPercentfloat32share of total host RAM used by the process, percent
memoryRssuint64resident set size in bytes
memoryVmsuint64virtual memory size in bytes
memorySwapuint64swap usage in bytes

get_loadmonitor.LoadInfo

Read live on every call.

FieldTypeDescription
load1float641-minute load average
load5float645-minute load average
load15float6415-minute load average

get_build_infomonitor.BuildInfo

Build metadata only; see Build Info Behavior for the fallback values.

FieldTypeDescription
vefVersionstringframework version, always stamped by the module
appVersionstringapplication version
buildTimestringbuild time
gitCommitstringgit commit

get_event_streamsmonitor.EventStreamsInfo

Reports cross-process event stream and consumer-group state through the optional event.StreamInspector (provided by the redis_stream transport).

FieldTypeDescription
enabledboolwhether an event.StreamInspector is available (the redis_stream transport is on); false means the report is an empty degradation, not an error
streams[]event.StreamInfoone entry per transport stream; empty when enabled is false

event.StreamInfo

FieldTypeDescription
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

FieldTypeDescription
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.

get_integration_statsmonitor.IntegrationStatsInfo

Reports per-node integration invocation statistics through the optional integration.StatsInspector. Numbers are in-memory counters held since process start — the invocation log is the durable record.

FieldTypeDescription
enabledboolwhether an integration.StatsInspector is available (the integration module is on); false means the report is an empty degradation, not an error
stats[]integration.InvocationStatsone entry per (system, contract, direction) tuple observed since process start, ordered by system, contract, then direction; empty when enabled is false

integration.InvocationStats

FieldTypeDescription
systemstringsystem code that served (or rejected) the invocation
contractstringinvoked contract code; empty for inbound deliveries rejected by verification — the contract code is unvalidated caller input at rejection time
directionstringoutbound or inbound
callsint64total invocations observed
successesint64invocations that completed successfully
failuresmap[string]int64failure counts keyed by failure kind (input_invalid, output_invalid, upstream, transport, timeout, canceled, script, config, auth, handler); omitted when empty
avgDurationMsint64average invocation duration in milliseconds
maxDurationMsint64maximum invocation duration in milliseconds
lastErrorstringmost recent failure message; omitted when no failure occurred
lastErrorAttimestamptime of the most recent failure; omitted when no failure occurred

See Integration Engine for how these counters are recorded.

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.