Documentation ¶
Index ¶
Constants ¶
const ( KeyKernelProcVersion = "host:kernel_proc_version" KeyKernelVersion = "host:kernel_version" KeyHostname = "host:hostname" KeyMachine = "host:machine" KeyIPAddress = "host:ip" )
Host metadata keys Changing these values is a customer-visible change.
const CPUOnlinePath = "/sys/devices/system/cpu/online"
const CPUPresentPath = "/sys/devices/system/cpu/present"
Variables ¶
var ValidTagRegex = regexp.MustCompile(`^[a-zA-Z0-9-:._]+$`)
Functions ¶
func AddMetadata ¶
AddMetadata adds host metadata to the result map, that is common across all environments. The IP address and hostname (part of the returned metadata) are evaluated in the context of PID 1's namespaces, in order to make the information agnostic to any container solutions. This may not be the best thing to do in some scenarios, but still seems to be the most sensible default.
func ParseCPUCoreIDs ¶
Read CPUs from /sys/device and report the core IDs as a list of integers.
func PresentCPUCores ¶
PresentCPUCores returns the number of present CPU cores.
func ValidateTags ¶
ValidateTags parses and validates user-specified tags. Each tag must match ValidTagRegex with ';' used as a separator. Tags that can't be validated are dropped. The empty string is returned if no tags can be validated.
Types ¶
This section is empty.