#920 Add metric `uwsgi_overview`.
This commit is contained in:
parent
5f77241a36
commit
d3e58b3422
|
@ -1,13 +1,29 @@
|
|||
package uwsgi
|
||||
|
||||
type StatsServer struct {
|
||||
// Tags
|
||||
Url string
|
||||
Pid int `json:"pid"`
|
||||
Uid int `json:"uid"`
|
||||
Gid int `json:"gid"`
|
||||
Version string `json:"version"`
|
||||
Cwd string `json:"cwd"`
|
||||
|
||||
// Fields
|
||||
ListenQueue int `json:"listen_queue"`
|
||||
ListenQueueErrors int `json:"listen_queue_errors"`
|
||||
SignalQueue int `json:"signal_queue"`
|
||||
Load int `json:"load"`
|
||||
|
||||
Workers []*Worker `json:"workers"`
|
||||
}
|
||||
|
||||
type Worker struct {
|
||||
Id int `json:"id"` // Tag
|
||||
Pid int `json:"pid"` // Tag
|
||||
// Tags
|
||||
Id int `json:"id"`
|
||||
Pid int `json:"pid"`
|
||||
|
||||
// Fields
|
||||
Accepting int `json:"accepting"`
|
||||
Requests int `json:"requests"`
|
||||
DeltaRequests int `json:"delta_requests"`
|
||||
|
@ -15,11 +31,11 @@ type Worker struct {
|
|||
Signals int `json:"signals"`
|
||||
SignalQueue int `json:"signal_queue"`
|
||||
Status string `json:"status"`
|
||||
RSS int `json:"rss"`
|
||||
VSZ int `json:"vsz"`
|
||||
Rss int `json:"rss"`
|
||||
Vsz int `json:"vsz"`
|
||||
RunningTime int `json:"running_time"`
|
||||
LastSpawn int `json:"last_spawn"`
|
||||
RespawnCount int `json:"respawn_count"`
|
||||
TX int `json:"tx"`
|
||||
AvgRT int `json:"avg_rt"`
|
||||
Tx int `json:"tx"`
|
||||
AvgRt int `json:"avg_rt"`
|
||||
}
|
||||
|
|
|
@ -62,11 +62,34 @@ func (u *Uwsgi) gatherURL(acc telegraf.Accumulator, url string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
u.gatherStatServer(acc, &s)
|
||||
u.gatherWorkers(acc, &s)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *Uwsgi) gatherStatServer(acc telegraf.Accumulator, s *StatsServer) error {
|
||||
fields := map[string]interface{}{
|
||||
"listen_queue": s.ListenQueue,
|
||||
"listen_queue_errors": s.ListenQueueErrors,
|
||||
"signal_queue": s.SignalQueue,
|
||||
"load": s.Load,
|
||||
}
|
||||
|
||||
tags := map[string]string{
|
||||
"url": s.Url,
|
||||
"pid": strconv.Itoa(s.Pid),
|
||||
"uid": strconv.Itoa(s.Uid),
|
||||
"gid": strconv.Itoa(s.Gid),
|
||||
"version": s.Version,
|
||||
"cwd": s.Cwd,
|
||||
}
|
||||
acc.AddFields("uwsgi_overview", fields, tags)
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (u *Uwsgi) gatherWorkers(acc telegraf.Accumulator, s *StatsServer) error {
|
||||
for _, w := range s.Workers {
|
||||
fields := map[string]interface{}{
|
||||
|
@ -77,13 +100,13 @@ func (u *Uwsgi) gatherWorkers(acc telegraf.Accumulator, s *StatsServer) error {
|
|||
"signals": w.Signals,
|
||||
"signal_queue": w.SignalQueue,
|
||||
"status": w.Status,
|
||||
"rss": w.RSS,
|
||||
"vsz": w.VSZ,
|
||||
"rss": w.Rss,
|
||||
"vsz": w.Vsz,
|
||||
"running_time": w.RunningTime,
|
||||
"last_spawn": w.LastSpawn,
|
||||
"respawn_count": w.RespawnCount,
|
||||
"tx": w.TX,
|
||||
"avg_rt": w.AvgRT,
|
||||
"tx": w.Tx,
|
||||
"avg_rt": w.AvgRt,
|
||||
}
|
||||
tags := map[string]string{
|
||||
"id": strconv.Itoa(w.Id),
|
||||
|
|
Loading…
Reference in New Issue