MCPcopy
hub / github.com/benoitc/gunicorn / show_stats

Method show_stats

gunicorn/ctl/handlers.py:164–193  ·  view source on GitHub ↗

Return server statistics. Returns: Dictionary with: - uptime: Seconds since arbiter started - pid: Arbiter PID - workers_current: Current number of workers - workers_spawned: Total workers spawned - workers_kil

(self)

Source from the content-addressed store, hash-verified

162 return config
163
164 def show_stats(self) -> dict:
165 """
166 Return server statistics.
167
168 Returns:
169 Dictionary with:
170 - uptime: Seconds since arbiter started
171 - pid: Arbiter PID
172 - workers_current: Current number of workers
173 - workers_spawned: Total workers spawned
174 - workers_killed: Total workers killed (if tracked)
175 - reloads: Number of reloads (if tracked)
176 """
177 stats = getattr(self.arbiter, '_stats', {})
178 start_time = stats.get('start_time')
179
180 uptime = None
181 if start_time:
182 uptime = round(time.time() - start_time, 2)
183
184 return {
185 "uptime": uptime,
186 "pid": self.arbiter.pid,
187 "workers_current": len(self.arbiter.WORKERS),
188 "workers_target": self.arbiter.num_workers,
189 "workers_spawned": stats.get('workers_spawned', 0),
190 "workers_killed": stats.get('workers_killed', 0),
191 "reloads": stats.get('reloads', 0),
192 "dirty_arbiter_pid": self.arbiter.dirty_arbiter_pid or None,
193 }
194
195 def show_listeners(self) -> dict:
196 """

Callers 2

test_show_statsMethod · 0.95
_handle_showMethod · 0.80

Calls 1

getMethod · 0.45

Tested by 1

test_show_statsMethod · 0.76