info

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJsonFromUrl

func GetJsonFromUrl(url string, bearerToken string, caCert []byte, allowInsecure bool, readTimeout time.Duration, logger *log.Logger) (string, error)

func GetKubernetesApiUrlFromEnv

func GetKubernetesApiUrlFromEnv() (string, error)

GetKubernetesApiUrlFromEnv returns the k8s api url based on the content of standard env var :

KUBERNETES_SERVICE_HOST
KUBERNETES_SERVICE_PORT
in case the above ENV variables doesn't  exist the function returns an empty string and an error

func GetKubernetesInfo

func GetKubernetesInfo(l *log.Logger) (string, string, string)

func GetKubernetesLatestVersion

func GetKubernetesLatestVersion(logger *log.Logger) (string, error)

func GetOsUptime

func GetOsUptime() (string, error)

Types

type K8sInfo

type K8sInfo struct {
	CurrentNamespace string `json:"current_namespace"`
	Version          string `json:"version"`
	Token            string `json:"token"`
	CaCert           string `json:"ca_cert"`
}

func GetKubernetesConnInfo

func GetKubernetesConnInfo(logger *log.Logger) (*K8sInfo, error)

type OsInfo

type OsInfo struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	VersionId string `json:"versionId"`
}

func GetOsInfo

func GetOsInfo() (*OsInfo, error)

type RuntimeInfo

type RuntimeInfo struct {
	Hostname            string              `json:"hostname"`              // host name reported by the kernel.
	Pid                 int                 `json:"pid"`                   // process id of the caller.
	PPid                int                 `json:"ppid"`                  // process id of the caller's parent.
	Uid                 int                 `json:"uid"`                   // numeric user id of the caller.
	Appname             string              `json:"appname"`               // name of this application
	Version             string              `json:"version"`               // version of this application
	ParamName           string              `json:"param_name"`            // value of the name parameter (_NO_PARAMETER_NAME_ if name was not set)
	RemoteAddr          string              `json:"remote_addr"`           // remote client ip address
	RequestId           string              `json:"request_id"`            // globally unique request id
	GOOS                string              `json:"goos"`                  // operating system
	GOARCH              string              `json:"goarch"`                // architecture
	Runtime             string              `json:"runtime"`               // go runtime at compilation time
	NumGoroutine        string              `json:"num_goroutine"`         // number of go routines
	OsReleaseName       string              `json:"os_release_name"`       // Linux release Name or _UNKNOWN_
	OsReleaseVersion    string              `json:"os_release_version"`    // Linux release Version or _UNKNOWN_
	OsReleaseVersionId  string              `json:"os_release_version_id"` // Linux release VersionId or _UNKNOWN_
	NumCPU              string              `json:"num_cpu"`               // number of cpu
	Uptime              string              `json:"uptime"`                // tells how long this service was started based on an internal variable
	UptimeOs            string              `json:"uptime_os"`             // tells how long system was started based on /proc/uptime
	K8sApiUrl           string              `json:"k8s_api_url"`           // url for k8s api based KUBERNETES_SERVICE_HOST
	K8sVersion          string              `json:"k8s_version"`           // version of k8s cluster
	K8sLatestVersion    string              `json:"k8s_latest_version"`    // latest version announced in https://kubernetes.io/
	K8sCurrentNamespace string              `json:"k8s_current_namespace"` // k8s namespace of this container
	EnvVars             []string            `json:"env_vars"`              // environment variables
	Headers             map[string][]string `json:"headers"`               // received headers
}

func CollectRuntimeInfo

func CollectRuntimeInfo(appName, version string, l *log.Logger) RuntimeInfo

Jump to

Keyboard shortcuts

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