Enable metrics for core queues
The following queues will provide metrics: * index_batch * index_interactive * receive_commits * send_email * ssh_batch_worker * ssh_command_start * ssh_interactive_worker * ssh_stream_worker For each queue following metrics are available: * active_threads - Number of threads that are actively executing tasks * max_pool_size - Maximum allowed number of threads in the pool * pool_size - Current number of threads in the pool * scheduled_tasks - Number of scheduled tasks in the queue * total_completed_tasks_count - Total number of tasks that have completed execution * total_scheduled_tasks_count - Total number of tasks that have been scheduled Change-Id: I9430c2a90d1fb07630c1c8b599abf6dd18e01b2d Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
This commit is contained in:
		 Eryk Szymanski
					Eryk Szymanski
				
			
				
					committed by
					
						 David Pursehouse
						David Pursehouse
					
				
			
			
				
	
			
			
			 David Pursehouse
						David Pursehouse
					
				
			
						parent
						
							366c3a652e
						
					
				
				
					commit
					04586d81fd
				
			| @@ -53,14 +53,28 @@ objects needing finalization. | ||||
| * `query/query_latency`: Successful query latency, accumulated over the life | ||||
| of the process. | ||||
|  | ||||
| === Work Queue | ||||
| === Core Queues | ||||
|  | ||||
| * `queue/work_queue/pool_size`: Current number of threads in the pool | ||||
| * `queue/work_queue/max_pool_size`: Maximum allowed number of threads in the pool | ||||
| * `queue/work_queue/active_threads`: Number of threads that are actively executing tasks | ||||
| * `queue/work_queue/scheduled_tasks`: Number of scheduled tasks in the queue | ||||
| * `queue/work_queue/total_scheduled_tasks_count`: Total number of tasks that have been scheduled | ||||
| * `queue/work_queue/total_completed_tasks_count`: Total number of tasks that have completed execution | ||||
| The following queues support metrics: | ||||
|  | ||||
| * default `WorkQueue` | ||||
| * index batch | ||||
| * index interactive | ||||
| * receive commits | ||||
| * send email | ||||
| * ssh batch worker | ||||
| * ssh command start | ||||
| * ssh interactive worker | ||||
| * ssh stream worker | ||||
|  | ||||
| Each queue provides the following metrics: | ||||
|  | ||||
| * `queue/<queue_name>/pool_size`: Current number of threads in the pool | ||||
| * `queue/<queue_name>/max_pool_size`: Maximum allowed number of threads in the pool | ||||
| * `queue/<queue_name>/active_threads`: Number of threads that are actively executing tasks | ||||
| * `queue/<queue_name>/scheduled_tasks`: Number of scheduled tasks in the queue | ||||
| * `queue/<queue_name>/total_scheduled_tasks_count`: Total number of tasks that have been scheduled | ||||
| * `queue/<queue_name>/total_completed_tasks_count`: Total number of tasks that have completed execution | ||||
|  | ||||
| === SSH sessions | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ public class ReceiveCommitsExecutorModule extends AbstractModule { | ||||
|     int poolSize = | ||||
|         config.getInt( | ||||
|             "receive", null, "threadPoolSize", Runtime.getRuntime().availableProcessors()); | ||||
|     return queues.createQueue(poolSize, "ReceiveCommits"); | ||||
|     return queues.createQueue(poolSize, "ReceiveCommits", true); | ||||
|   } | ||||
|  | ||||
|   @Provides | ||||
| @@ -53,7 +53,7 @@ public class ReceiveCommitsExecutorModule extends AbstractModule { | ||||
|     if (poolSize == 0) { | ||||
|       return MoreExecutors.newDirectExecutorService(); | ||||
|     } | ||||
|     return queues.createQueue(poolSize, "SendEmail"); | ||||
|     return queues.createQueue(poolSize, "SendEmail", true); | ||||
|   } | ||||
|  | ||||
|   @Provides | ||||
|   | ||||
| @@ -181,7 +181,8 @@ public class IndexModule extends LifecycleModule { | ||||
|     if (threads <= 0) { | ||||
|       threads = Runtime.getRuntime().availableProcessors() / 2 + 1; | ||||
|     } | ||||
|     return MoreExecutors.listeningDecorator(workQueue.createQueue(threads, "Index-Interactive")); | ||||
|     return MoreExecutors.listeningDecorator( | ||||
|         workQueue.createQueue(threads, "Index-Interactive", true)); | ||||
|   } | ||||
|  | ||||
|   @Provides | ||||
| @@ -199,7 +200,8 @@ public class IndexModule extends LifecycleModule { | ||||
|     if (batchThreads <= 0) { | ||||
|       batchThreads = Runtime.getRuntime().availableProcessors(); | ||||
|     } | ||||
|     return MoreExecutors.listeningDecorator(workQueue.createQueue(batchThreads, "Index-Batch")); | ||||
|     return MoreExecutors.listeningDecorator( | ||||
|         workQueue.createQueue(batchThreads, "Index-Batch", true)); | ||||
|   } | ||||
|  | ||||
|   @Singleton | ||||
|   | ||||
| @@ -43,9 +43,9 @@ public class CommandExecutorQueueProvider implements QueueProvider { | ||||
|       poolSize += batchThreads; | ||||
|     } | ||||
|     int interactiveThreads = Math.max(1, poolSize - batchThreads); | ||||
|     interactiveExecutor = queues.createQueue(interactiveThreads, "SSH-Interactive-Worker"); | ||||
|     interactiveExecutor = queues.createQueue(interactiveThreads, "SSH-Interactive-Worker", true); | ||||
|     if (batchThreads != 0) { | ||||
|       batchExecutor = queues.createQueue(batchThreads, "SSH-Batch-Worker"); | ||||
|       batchExecutor = queues.createQueue(batchThreads, "SSH-Batch-Worker", true); | ||||
|       setThreadFactory(batchExecutor); | ||||
|     } else { | ||||
|       batchExecutor = interactiveExecutor; | ||||
|   | ||||
| @@ -76,7 +76,7 @@ class CommandFactoryProvider implements Provider<CommandFactory>, LifecycleListe | ||||
|     createCommandInterceptor = i; | ||||
|  | ||||
|     int threads = cfg.getInt("sshd", "commandStartThreads", 2); | ||||
|     startExecutor = workQueue.createQueue(threads, "SshCommandStart"); | ||||
|     startExecutor = workQueue.createQueue(threads, "SshCommandStart", true); | ||||
|     destroyExecutor = | ||||
|         Executors.newSingleThreadExecutor( | ||||
|             new ThreadFactoryBuilder() | ||||
|   | ||||
| @@ -36,7 +36,7 @@ class StreamCommandExecutorProvider implements Provider<WorkQueue.Executor> { | ||||
|   public WorkQueue.Executor get() { | ||||
|     final WorkQueue.Executor executor; | ||||
|  | ||||
|     executor = queues.createQueue(poolSize, "SSH-Stream-Worker"); | ||||
|     executor = queues.createQueue(poolSize, "SSH-Stream-Worker", true); | ||||
|  | ||||
|     final ThreadFactory parent = executor.getThreadFactory(); | ||||
|     executor.setThreadFactory( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user