Skip to content

Commit ac60885

Browse files
author
Faisal Memon
committed
add slot stats
1 parent 1d1c4c2 commit ac60885

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

client/nginx.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ type Slabs map[string]Slab
147147
// Slab represents slab related stats.
148148
type Slab struct {
149149
Pages Pages
150+
Slots Slots
150151
}
151152

152153
// Pages represents the slab memory usage stats.
@@ -155,6 +156,17 @@ type Pages struct {
155156
Free uint64
156157
}
157158

159+
// Slots is a map of slots by slot size
160+
type Slots map[string]Slot
161+
162+
// Slot represents slot related stats.
163+
type Slot struct {
164+
Used uint64
165+
Free uint64
166+
Reqs uint64
167+
Fails uint64
168+
}
169+
158170
// HTTPRequests represents HTTP request related stats.
159171
type HTTPRequests struct {
160172
Total uint64
@@ -922,12 +934,12 @@ func determineStreamUpdates(updatedServers []StreamUpstreamServer, nginxServers
922934
func (client *NginxClient) GetStats() (*Stats, error) {
923935
info, err := client.getNginxInfo()
924936
if err != nil {
925-
return nil, fmt.Errorf("failed to get stats %v", err)
937+
return nil, fmt.Errorf("failed to get stats: %v", err)
926938
}
927939

928940
slabs, err := client.getSlabs()
929941
if err != nil {
930-
return nil, fmt.Errorf("failed to get stats %v", err)
942+
return nil, fmt.Errorf("failed to get stats: %v", err)
931943
}
932944

933945
cons, err := client.getConnections()

0 commit comments

Comments
 (0)