mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-30 19:43:47 +00:00 
			
		
		
		
	queue_processors: Remove the slow_queries queue.
While this functionality to post slow queries to a Zulip stream was very useful in the early days of Zulip, when there were only a few hundred accounts, it's long since been useless since (1) the total request volume on larger Zulip servers run by Zulip developers, and (2) other server operators don't want real-time notifications of slow backend queries. The right structure for this is just a log file. We get rid of the queue and replace it with a "zulip.slow_queries" logger, which will still log to /var/log/zulip/slow_queries.log for ease of access to this information and propagate to the other logging handlers. Reducing the amount of queues is good for lowering zulip's memory footprint and restart performance, since we run at least one dedicated queue worker process for each one in most configurations.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							180c16c80e
						
					
				
				
					commit
					dd40649e04
				
			| @@ -21,7 +21,6 @@ from zerver.lib.debug import maybe_tracemalloc_listen | ||||
| from zerver.lib.db import reset_queries | ||||
| from zerver.lib.exceptions import ErrorCode, JsonableError, RateLimited | ||||
| from zerver.lib.html_to_text import get_content_description | ||||
| from zerver.lib.queue import queue_json_publish | ||||
| from zerver.lib.rate_limiter import RateLimitResult | ||||
| from zerver.lib.response import json_error, json_response_from_error | ||||
| from zerver.lib.subdomains import get_subdomain | ||||
| @@ -30,6 +29,7 @@ from zerver.lib.types import ViewFuncT | ||||
| from zerver.models import Realm, flush_per_request_caches, get_realm | ||||
|  | ||||
| logger = logging.getLogger('zulip.requests') | ||||
| slow_query_logger = logging.getLogger('zulip.slow_queries') | ||||
|  | ||||
| def record_request_stop_data(log_data: MutableMapping[str, Any]) -> None: | ||||
|     log_data['time_stopped'] = time.time() | ||||
| @@ -210,8 +210,7 @@ def write_log_line(log_data: MutableMapping[str, Any], path: str, method: str, r | ||||
|         logger.info(logger_line) | ||||
|  | ||||
|     if (is_slow_query(time_delta, path)): | ||||
|         queue_json_publish("slow_queries", dict( | ||||
|             query="%s (%s)" % (logger_line, requestor_for_logs))) | ||||
|         slow_query_logger.info(logger_line) | ||||
|  | ||||
|     if settings.PROFILE_ALL_REQUESTS: | ||||
|         log_data["prof"].disable() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user