micro/debug/stats/stats.go

33 lines
620 B
Go
Raw Normal View History

2019-12-04 11:53:20 +00:00
// Package stats provides runtime stats
package stats
// Stats provides stats interface
type Stats interface {
2019-12-04 23:51:07 +00:00
// Read stat snapshot
Read() ([]*Stat, error)
2019-12-04 11:53:20 +00:00
// Write a stat snapshot
Write(*Stat) error
2019-12-18 18:36:42 +00:00
// Record a request
Record(error) error
2019-12-04 11:53:20 +00:00
}
// A runtime stat
type Stat struct {
2019-12-04 23:51:07 +00:00
// Timestamp of recording
Timestamp int64
2019-12-04 11:53:20 +00:00
// Start time as unix timestamp
Started int64
2019-12-04 23:51:07 +00:00
// Uptime in seconds
2019-12-04 11:53:20 +00:00
Uptime int64
// Memory usage in bytes
Memory uint64
// Threads aka go routines
Threads uint64
// Garbage collection in nanoseconds
GC uint64
2019-12-18 18:36:42 +00:00
// Total requests
Requests uint64
// Total errors
Errors uint64
2019-12-04 11:53:20 +00:00
}