monitor

package
v0.0.0-...-8f072b4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppMetricsLogFilePath  = "/ghostdb/ghostdb_appMetrics.log"
	AppMetricsTempFileName = "/ghostdb/ghostdb_appMetrics_tmp.log"
	MaxAppMetricsLogSize   = 500000
)

AppMetricsLogFilePath Log file path

Variables

This section is empty.

Functions

func AddHit

func AddHit(appMetrics *AppMetrics)

AddHit is a setter that increments its corresponding struct field every time a endpoint is hit it also increments a total value

func CacheMiss

func CacheMiss(appMetrics *AppMetrics)

CacheMiss is a setter that increments its corresponding struct field by one

func DeleteHit

func DeleteHit(appMetrics *AppMetrics)

DeleteHit is a setter that increments its corresponding struct field every time a endpoint is hit it also increments a total value

func Dump

func Dump(appMetrics *AppMetrics)

Dump writes the contents of the appMetrics struct to the appMetrics log file

func ErrFlush

func ErrFlush(appMetrics *AppMetrics)

ErrFlush is a setter that increments its corresponding struct field by one

func FlushHit

func FlushHit(appMetrics *AppMetrics)

FlushHit is a setter that increments its corresponding struct field every time a endpoint is hit it also increments a total value

func Flushed

func Flushed(appMetrics *AppMetrics)

Flushed is a setter that increments its corresponding struct field by one

func GetAppMetrics

func GetAppMetrics() response.CacheResponse

GetAppMetrics reads the AppMetrics log unmarshals each entry and appends it to a slice

func GetHit

func GetHit(appMetrics *AppMetrics)

GetHit is a setter that increments its corresponding struct field every time a endpoint is hit it also increments a total value

func NotFound

func NotFound(appMetrics *AppMetrics)

NotFound is a setter that increments its corresponding struct field by one

func NotStored

func NotStored(appMetrics *AppMetrics)

NotStored is a setter that increments its corresponding struct field by one

func PutHit

func PutHit(appMetrics *AppMetrics)

PutHit is a setter that increments its corresponding struct field every time a endpoint is hit it also increments a total value

func Removed

func Removed(appMetrics *AppMetrics)

Removed is a setter that increments its corresponding struct field by one

func Stored

func Stored(appMetrics *AppMetrics)

Stored is a setter that increments its corresponding struct field by one

func WriteMetrics

func WriteMetrics(appMetrics *AppMetrics, cmd string, resp response.CacheResponse)

Types

type AppMetrics

type AppMetrics struct {
	// TotalRequests is the cumulative number
	// of requests to the cache node.
	TotalRequests uint64

	// GetRequests is the cumulative number
	// of Get requests to the cache node.
	GetRequests uint64

	// PutRequests is the cumulative number
	// of Put requests to the cache node.
	PutRequests uint64

	// AddRequests it the cumulative number
	// of Add requests to the cache node.
	AddRequests uint64

	// DeleteRequests is the cumulative number
	// of Delete requests to the cache node.
	DeleteRequests uint64

	// FlushRequests is the cumulative number
	// of Flush requests received by the cache node.
	FlushRequests uint64

	// CacheMiss is the cumulative number of cache misses
	// encountered by the cache node.
	CacheMiss uint64

	// Stored is the cumulative number of key-value pairs
	// successfully stored into the cache node.
	Stored uint64

	// Not stored is the cumulative number of key-value
	// pairs unsuccessfully stored into the cache node.
	NotStored uint64

	// Removed is the cumulative number of key-value pairs
	// removed from the cache node. This includes key-value
	// pairs removed by the cache crawlers.
	Removed uint64

	// NotFound is the cumulative number of key-value pairs
	// not found in the cache during a deletion.
	NotFound uint64

	// Flushed is the cumulative number of key-value pairs
	// removed from the cache node by flushes
	Flushed uint64

	// ErrFlush is the cumulative number of errors received
	// when attempting to flush the cache node.
	ErrFlush uint64

	// Mux is a mutex lock.
	Mux sync.Mutex

	// WriteInterval is the interval for writing log entries.
	WriteInterval time.Duration

	// EntryTimestamp is a bool representing whether or not to
	// include timestamps on the log entries.
	EntryTimestamp bool
}

AppMetrics struct is used to record cache events

func NewAppMetrics

func NewAppMetrics(writeInterval time.Duration, entryTimestamp bool) *AppMetrics

Boot instantiates a appMetrics log struct and its corresponding log file

type ReadAppMetrics

type ReadAppMetrics struct {
	Timestamp      string `json:"Timestamp"`
	TotalRequests  uint64
	GetRequests    uint64
	PutRequests    uint64
	AddRequests    uint64
	DeleteRequests uint64
	FlushRequests  uint64

	CacheMiss uint64
	Stored    uint64 `json: "-"`
	NotStored uint64
	Removed   uint64 `json: "-"`
	NotFound  uint64
	Flushed   uint64 `json: "-"`
	ErrFlush  uint64
}

ReadAppMetrics struct is used to Unmarshal log entries

Jump to

Keyboard shortcuts

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