stats

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const RedisType = "redis"

RedisType defines the type name of redis backend

View Source
const StatsPushInterval = 2 * time.Second

StatsPushInterval defines how many times we push metrics

Variables

This section is empty.

Functions

func Monitor

func Monitor(addr string, ns string, id string, backend io.WriteCloser) error

Monitor enable continuous metric fetching and forwarding to a backend

func NewRedis

func NewRedis(endpoint string) (io.WriteCloser, error)

NewRedis create new redis backend and initialize connection

func RedisParseURL

func RedisParseURL(address string) (host string, channel string, err error)

RedisParseURL parse an url and returns interresting part after validation

Types

type Metrics

type Metrics struct {
	Timestamp   int64  `json:"timestamp"`
	MemoryUsage uint64 `json:"memory_usage"`
	MemoryLimit uint64 `json:"memory_limit"`
	MemoryCache uint64 `json:"memory_cache"`
	CPUUsage    uint64 `json:"cpu_usage"`
	PidsCurrent uint64 `json:"pids_current"`
}

Metrics define a one-shot set of stats with differents metrics

type Redis

type Redis struct {
	Endpoint string `bson:"stdout" json:"endpoint"`
}

Redis defines how to connect a stats redis backend

type RedisBackend

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

RedisBackend define an internal redis backend

func (*RedisBackend) Close

func (c *RedisBackend) Close() error

Close closes redis connection

func (*RedisBackend) Write

func (c *RedisBackend) Write(data []byte) (int, error)

Write will write to the channel

type Stats added in v0.4.9

type Stats struct {
	Type string `bson:"type" json:"type"`
	Data Redis  `bson:"data" json:"data"`
}

Stats defines a stats backend

Jump to

Keyboard shortcuts

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