summaryrefslogtreecommitdiff
path: root/tests/unit/test_web.py
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-02-02 16:05:15 -0800
committerJames E. Blair <jim@acmegating.com>2022-02-02 17:29:50 -0800
commitb0d36267f3d9114e2be1ca75513550a2162a88ac (patch)
treea5995e40034c47fadcd749498fe90a2d642e164a /tests/unit/test_web.py
parent482338f70c867ccbc63c0825d57b380cdf9b5ea7 (diff)
downloadzuul-b0d36267f3d9114e2be1ca75513550a2162a88ac.tar.gz
Add stats to web server
This adds matrics which report the number of thread workers in use as well as the number of requests queued at the start of each request in cherrypy. It also reports the number of streamers currently running. These can help us detect and diagnose problems with the web server. Change-Id: Iadf9479ae84167892ab11ae122f275637c0c6c6f
Diffstat (limited to 'tests/unit/test_web.py')
-rw-r--r--tests/unit/test_web.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py
index e5d966f79..a21cc773d 100644
--- a/tests/unit/test_web.py
+++ b/tests/unit/test_web.py
@@ -1,5 +1,6 @@
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# Copyright 2014 Rackspace Australia
+# Copyright 2021-2022 Acme Gating, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -26,6 +27,7 @@ from unittest import skip
import requests
+from zuul.lib.statsd import normalize_statsd_name
import zuul.web
from tests.base import ZuulTestCase, AnsibleZuulTestCase
@@ -232,6 +234,11 @@ class TestWeb(BaseTestWeb):
self.assertEqual(len(status_jobs[2]['dependencies']), 1)
self.assertIn('project-merge', status_jobs[1]['dependencies'])
self.assertIn('project-merge', status_jobs[2]['dependencies'])
+ hostname = normalize_statsd_name(socket.getfqdn())
+ self.assertReportedStat(
+ f'zuul.web.server.{hostname}.threadpool.idle', kind='g')
+ self.assertReportedStat(
+ f'zuul.web.server.{hostname}.threadpool.queue', kind='g')
def test_web_components(self):
"Test that we can retrieve the list of connected components"