host

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package host has all the functions to get host metadata needed by traces and metrics. It also maintains an update-to-date global HostID object, which is refreshed periodically.

Index

Constants

View Source
const (
	REDHAT    = "/etc/redhat-release"
	AMAZON    = "/etc/system-release"
	UBUNTU    = "/etc/lsb-release"
	DEBIAN    = "/etc/debian_version"
	SUSE      = "/etc/os-release"
	SUSE_OLD  = "/etc/SuSE-release"
	SLACKWARE = "/etc/slackware-version"
	GENTOO    = "/etc/gentoo-release"
	OTHER     = "/etc/issue"
)

Variables

This section is empty.

Functions

func ConfiguredHostname

func ConfiguredHostname() string

ConfiguredHostname returns the hostname configured by user

func Distro

func Distro() string

Distro returns the distro information

func FilteredIfaces

func FilteredIfaces() ([]net.Interface, error)

FilteredIfaces returns a list of Interface which contains only interfaces required. See https://swicloud.atlassian.net/browse/AO-9021

func GC

func GC(stats *debug.GCStats)

GC collects current statistics of garbage collector

func Hostname

func Hostname() string

Hostname returns the hostname

func IPAddresses

func IPAddresses() []string

IPAddresses gets the system's IP addresses

func IsPhysicalInterface

func IsPhysicalInterface(ifname string) bool

IsPhysicalInterface returns true if the specified interface name is physical

func Mem

func Mem(m *runtime.MemStats)

Mem returns the current memory statistics. Don't call this function too often as it stops the world while gathering the information.

func PID

func PID() int

PID returns the cached process ID

func Start

func Start()

Start starts the host observer as a standalone goroutine, which will refresh the host metadata periodically

func Stop

func Stop()

Stop stops the host metadata refreshing goroutine

Types

type ID

type ID struct {
	// contains filtered or unexported fields
}

ID defines the minimum set of host metadata that identifies a host

func BestEffortCurrentID

func BestEffortCurrentID() ID

BestEffortCurrentID returns the current host ID with the best effort. It doesn't wait until the ID is ready. This function is used mainly by getSettings where the ID may not be fully initialized immediately after starting up but it's acceptable.

func CurrentID

func CurrentID() ID

CurrentID returns a copyID of the current ID

func (ID) AzureAppInstId

func (h ID) AzureAppInstId() string

AzureAppInstId returns the Azure's web application instance ID

func (ID) ContainerId

func (h ID) ContainerId() string

ContainerId returns the containerId field of ID

func (ID) EC2Id

func (h ID) EC2Id() string

EC2Id returns ec2id field of ID

func (ID) EC2Zone

func (h ID) EC2Zone() string

EC2Zone returns the ec2ZoneURL field of ID

func (ID) HerokuId

func (h ID) HerokuId() string

HerokuId returns the herokuId field of ID

func (ID) Hostname

func (h ID) Hostname() string

Hostname returns the hostname field of ID

func (ID) MAC

func (h ID) MAC() []string

MAC returns the mac field of ID

func (ID) Pid

func (h ID) Pid() int

Pid returns the pid field of ID

type IDSetter

type IDSetter func(h *ID)

IDSetter defines a function type which set a field of ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL