stat

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWriteFailed = errors.New("submit failed")
View Source
var (
	LogInterval = time.Minute
)

Functions

func CpuUsage

func CpuUsage() int64

func Report

func Report(msg string)

func SetReportWriter

func SetReportWriter(writer Writer)

func SetReporter

func SetReporter(fn func(string))

Types

type Metrics

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

func NewMetrics

func NewMetrics(name string) *Metrics

func (*Metrics) Add

func (m *Metrics) Add(task Task)

func (*Metrics) AddDrop

func (m *Metrics) AddDrop()

func (*Metrics) SetName

func (m *Metrics) SetName(name string)

type RemoteWriter

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

func (*RemoteWriter) Write

func (rw *RemoteWriter) Write(report *StatReport) error

type StatReport

type StatReport struct {
	Name          string  `json:"name"`
	Timestamp     int64   `json:"tm"`
	Pid           int     `json:"pid"`
	ReqsPerSecond float32 `json:"qps"`
	Drops         int     `json:"drops"`
	Average       float32 `json:"avg"`
	Median        float32 `json:"med"`
	Top90th       float32 `json:"t90"`
	Top99th       float32 `json:"t99"`
	Top99p9th     float32 `json:"t99p9"`
}

type Task

type Task struct {
	Drop        bool
	Duration    time.Duration
	Description string
}

type Writer

type Writer interface {
	Write(report *StatReport) error
}

func NewRemoteWriter

func NewRemoteWriter(endpoint string) Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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