github.com/annwntech/go-micro/v2@v2.9.5/debug/stats/stats.go (about)

     1  // Package stats provides runtime stats
     2  package stats
     3  
     4  // Stats provides stats interface
     5  type Stats interface {
     6  	// Read stat snapshot
     7  	Read() ([]*Stat, error)
     8  	// Write a stat snapshot
     9  	Write(*Stat) error
    10  	// Record a request
    11  	Record(error) error
    12  }
    13  
    14  // A runtime stat
    15  type Stat struct {
    16  	// Timestamp of recording
    17  	Timestamp int64
    18  	// Start time as unix timestamp
    19  	Started int64
    20  	// Uptime in seconds
    21  	Uptime int64
    22  	// Memory usage in bytes
    23  	Memory uint64
    24  	// Threads aka go routines
    25  	Threads uint64
    26  	// Garbage collection in nanoseconds
    27  	GC uint64
    28  	// Total requests
    29  	Requests uint64
    30  	// Total errors
    31  	Errors uint64
    32  }
    33  
    34  var (
    35  	DefaultStats = NewStats()
    36  )