structures

package
v0.0.0-...-0a5d1ac Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	ActionName string                                      `json:"action_name"`
	ActionType string                                      `json:"action_type"` // default: "custom" else "internal" (like profiling, restart)
	Callback   func(payload map[string]interface{}) string `json:"-"`
}

Action like AxmAction

type Apm

type Apm struct {
	Type    string `json:"type"`
	Version string `json:"version"`
}

type CPU

type CPU struct {
	Number int    `json:"number"`
	Info   string `json:"info"`
}

CPU informations

type Config

type Config struct {
	PublicKey       string
	PrivateKey      string
	Name            string
	ServerName      string
	Hostname        string
	Node            *string
	Proxy           string
	ProcessUniqueID string
}

Config from user code

func (*Config) InitNames

func (config *Config) InitNames()

InitNames with random values

type Metric

type Metric struct {
	Name     string  `json:"name"`
	Value    float64 `json:"value"`
	Category string  `json:"type"`
	Historic bool    `json:"historic"`
	Unit     string  `json:"unit"`

	Aggregation string `json:"agg_type"`

	Function func() float64 `json:"-"`
}

Metric like AxmMonitor

func CreateFuncMetric

func CreateFuncMetric(name string, category string, unit string, cb func() float64) Metric

CreateFuncMetric with default values and exposed function

func CreateMetric

func CreateMetric(name string, category string, unit string) Metric

CreateMetric with default values

func (*Metric) Get

func (metric *Metric) Get() float64

Get current value and check func if provided

func (*Metric) Set

func (metric *Metric) Set(value float64)

Set current value

type Options

type Options struct {
	DefaultActions bool `json:"default_actions"`
	CustomProbes   bool `json:"custom_probes"`
	Profiling      bool `json:"profiling"`
	HeapDump       bool `json:"heapdump"`
	Apm            Apm  `json:"apm"`
}

Options like AxmOptions

type Process

type Process struct {
	Name   string `json:"name"`
	Server string `json:"server"`
	Rev    string `json:"rev"`
	PmID   int    `json:"pm_id"`
}

Process data

type ProfilingRequest

type ProfilingRequest struct {
	Timeout int64 `json:"timeout"`
}

ProfilingRequest from KM

type ProfilingResponse

type ProfilingResponse struct {
	Data      string `json:"data"`
	At        int64  `json:"at"`
	Initiated string `json:"initiated"`
	Duration  int    `json:"duration"`
	Type      string `json:"type"`
	Encoding  string `json:"encoding"`
}

ProfilingResponse to KM (data as string)

func NewProfilingResponse

func NewProfilingResponse(data []byte, element string) ProfilingResponse

NewProfilingResponse with default values

type Server

type Server struct {
	Loadavg     []float64 `json:"loadavg"`
	TotalMem    uint64    `json:"total_mem,omitempty"`
	FreeMem     int64     `json:"free_mem,omitempty"`
	CPU         CPU       `json:"cpu"`
	Hostname    string    `json:"hostname"`
	Uptime      int64     `json:"uptime"`
	Type        string    `json:"type"`
	Platform    string    `json:"platform"`
	Arch        string    `json:"arch"`
	User        string    `json:"user"`
	Interaction bool      `json:"interaction"`
	Pm2Version  string    `json:"pm2_version"`
	NodeVersion string    `json:"node_version"`
	RemoteIP    string    `json:"remote_ip"`
	RemotePort  int       `json:"remote_port"`
}

Server of status packet

type Status

type Status struct {
	Process []StatusProcess `json:"process"`
	Server  Server          `json:"server"`
}

Status packet

type StatusProcess

type StatusProcess struct {
	Pid         int32              `json:"pid"`
	Name        string             `json:"name"`
	Server      string             `json:"server"`
	Interpreter string             `json:"interpreter,omitempty"`
	RestartTime int                `json:"restart_time,omitempty"`
	CreatedAt   int64              `json:"created_at,omitempty"`
	ExecMode    string             `json:"exec_mode,omitempty"`
	Watching    bool               `json:"watching,omitempty"`
	PmUptime    int64              `json:"pm_uptime,omitempty"`
	Status      string             `json:"status,omitempty"`
	PmID        int                `json:"pm_id"`
	CPU         float64            `json:"cpu"`
	Rev         string             `json:"rev"`
	Memory      uint64             `json:"memory"`
	UniqueID    string             `json:"unique_id"`
	NodeEnv     string             `json:"node_env,omitempty"`
	AxmActions  []*Action          `json:"axm_actions,omitempty"`
	AxmMonitor  map[string]*Metric `json:"axm_monitor,omitempty"`
	AxmOptions  Options            `json:"axm_options,omitempty"`
}

StatusProcess data

Jump to

Keyboard shortcuts

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