gohai

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gohai

type Gohai struct {
	// CPU contains CPU information.
	// Type check:
	// - Collect calls getCPUInfo: https://github.com/DataDog/gohai/blob/4316413/cpu/cpu.go#L63
	//   - On macOS, getCPUInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/cpu/cpu_darwin.go#L25
	//   - On Linux/arm64, getCPUInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/cpu/cpu_linux_arm64.go#L26
	//   - On Linux/!arm64, getCPUInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/cpu/cpu_linux_default.go#L36
	//   - On Windows, getCPUInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/cpu/cpu_windows.go#L221
	//
	// All branches return a map[string]string, so we can safely define CPU as map[string]string.
	CPU map[string]string `json:"cpu"`

	// FileSystem contains filesystem information.
	// Type check:
	// - Collect calls getFileSystemInfo https://github.com/DataDog/gohai/blob/4316413/filesystem/filesystem_common.go#L23
	//   - On Linux, getFileSystemInfo calls parseDfOutput: https://github.com/DataDog/gohai/blob/4316413/filesystem/filesystem.go#L39
	//     - parseDfOutput returns a []any: https://github.com/DataDog/gohai/blob/4316413/filesystem/filesystem.go#L58
	//   - On Windows, getFileSystemInfo returns a []any: https://github.com/DataDog/gohai/blob/4316413/filesystem/filesystem_windows.go#L121
	//
	// All branches return a []any, so we can safely define FileSystem as []any.
	FileSystem []any `json:"filesystem"`

	// Memory contains memory information.
	// Type check:
	// - Collect calls getMemoryInfo: https://github.com/DataDog/gohai/blob/4316413/memory/memory.go#L28
	//   - On macOS, getMemoryInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/memory/memory_darwin.go#L16
	//   - On Linux, getMemoryInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/memory/memory_linux.go#L24
	//   - On Windows, getMemoryInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/memory/memory_windows.go#L29
	//
	// All branches return a map[string]string, so we can safely define Memory as map[string]string.
	Memory map[string]string `json:"memory"`

	// Network contains network information.
	// Type check:
	// - Collect calls getNetworkInfo: https://github.com/DataDog/gohai/blob/4316413/network/network_common.go#L41
	//   - getNetworkInfo returns a map[string]any: https://github.com/DataDog/gohai/blob/4316413/network/network.go#L9
	//
	// All branches return a map[string]any, so we can safely define Network as map[string]any.
	Network map[string]any `json:"network"`

	// Platform contains platform information.
	// Type check:
	// - Collect calls getPlatformInfo: https://github.com/DataDog/gohai/blob/4316413/platform/platform.go#L22
	//   - getPlatformInfo returns a map[string]string: https://github.com/DataDog/gohai/blob/4316413/platform/platform.go#L52
	//
	// All branches return a map[string]string, so we can safely define Platform as map[string]string.
	Platform map[string]string `json:"platform"`
}

Gohai is the inner payload for Gohai. Its types must match those returned by Datadog/gohai. The `Collect` methods from DataDog/gohai return an interface{}, so we need to carefully define the types of the fields here.

type Payload

type Payload struct {
	Gohai gohaiMarshaler `json:"gohai"`
}

Payload handles the JSON unmarshalling of the metadata payload As weird as it sounds, in the v5 payload the value of the "gohai" field is a JSON-formatted string. So this struct contains a MarshaledGohaiPayload which will be marshaled as a JSON-formatted string.

func NewEmpty

func NewEmpty() Payload

NewEmpty creates a new empty Gohai payload.

func (*Payload) CPU added in v0.8.1

func (p *Payload) CPU() map[string]string

CPU returns a reference to the Gohai payload 'cpu' map. It initializes the field if nil.

func (*Payload) Network added in v0.11.0

func (p *Payload) Network() map[string]any

Network returns a reference to the Gohai payload 'network' map. It initializes the field if nil.

func (*Payload) Platform added in v0.5.2

func (p *Payload) Platform() map[string]string

Platform returns a reference to the Gohai payload 'platform' map. It initializes the field if nil.

type ProcessesPayload

type ProcessesPayload struct {
	Processes map[string]interface{} `json:"processes"`
	Meta      map[string]string      `json:"meta"`
}

ProcessesPayload handles the JSON unmarshalling

Jump to

Keyboard shortcuts

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