micro/debug/stats/stats.go

33 lines
620 B
Go
Raw Normal View History

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