status

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppName is application name
	AppName = "server"
	// AppVersion is the application version
	AppVersion = config.Version
	// AppRelease is the application release
	AppRelease = config.Commit
)

Functions

func GetUptime

func GetUptime(start time.Time) string

GetUptime returns uptime of server

func GetVersion

func GetVersion() string

GetVersion returns name-version-release as a string

func GetVersionJSON

func GetVersionJSON() string

GetVersionJSON returns version info as JSON

func RequestResponseBody

func RequestResponseBody(url string) []byte

RequestResponseBody will perform an http Get using the provided url and return the body as a []byte TODO use built in functions for this instead of calling endpoints

Types

type Health

type Health struct {
	Readiness types.JSONText `json:"readiness" yaml:"readiness"`
	Liveness  types.JSONText `json:"liveness" yaml:"liveness"`
}

Health reports the links to the health monitors

func NewHealth

func NewHealth(server string) *Health

NewHealth will get the health of the service given a server address using the provided address to hit that services' endpoints TODO use built in functions for this instead of calling endpoints

type Metadata

type Metadata struct {
	Verbose   bool   `json:"verbose" yaml:"verbose"`
	Resources string `json:"resources" yaml:"resources"`
}

Metadata struct for info about service-specific fields

func NewMetadata

func NewMetadata(cfg *config.ServerConfig) *Metadata

NewServerStatus creates a new Status struct for use in a Status service

type Status

type Status struct {
	Service   *Version    `json:"service" yaml:"service"`
	Uptime    string      `json:"uptime" yaml:"uptime"`
	Debug     bool        `json:"debug" yaml:"debug"`
	Health    *Health     `json:"health" yaml:"health"`
	StartTime time.Time   `json:"start_time" yaml:"start_time"`
	Host      string      `json:"host" yaml:"host"`
	Port      string      `json:"port" yaml:"port"`
	MetaData  interface{} `json:"metadata" yaml:"metadata"`
}

Status reports the characteristics of the Service

func New

func New(cfg *config.ServerConfig) *Status

New will return a new Status struct for service given a name, version, release, debug variable, and start time.

func (*Status) GetStatus

func (s *Status) GetStatus() string

GetStatus returns a string of JSON equivalent to the given Status

type Version

type Version struct {
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
	Release string `json:"release" yaml:"release"`
}

Version struct for storing Version info

func NewVersion

func NewVersion() *Version

NewVersion returns a populated Version struct

Jump to

Keyboard shortcuts

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