Page MenuHomeMiraheze

Jobs Statistics in Grafana
Closed, ResolvedPublic

Description

Job statistics would be a critical thing for us to collect in order to consider how to resolve on-going issues with the jobqueue. Without these statistics, it would not be possible to investigate regular patterns or monitoring impact of changes we make.

Event Timeline

John triaged this task as Normal priority.Mar 15 2021, 16:09
John created this task.

Redis:

Get a list of all h-sha1ById, loop over them running a HLEN on the key will return how many unclaimed jobs there are by job type - add these up and then the data exists for both the whole jobqueue but also per job (and if you want to go further, each job type by each wiki)

Universal_Omega removed a project: Universal Omega.

Due to circumstances, I'm resigning as system administrator and therefore currently unable to complete this task. My sincere apologies for not completing this task.

Basic LUA script to handle this:

local count = 0
local keys = redis.call( 'KEYS', '*:z-claimed' )
for _,key in ipairs(keys) do
  local sum = redis.call( 'ZCARD', key )
  count = count + tonumber(sum)
end
return count

Would return the number of all claimed jobs. This can be ran via Grafana, for CLI example:

127.0.0.1:6379> EVAL "local count = 0 local keys = redis.call( 'KEYS', '*:z-claimed' ) for _,key in ipairs(keys) do local sum = redis.call( 'ZCARD', key ) count = count + tonumber(sum) end return count" 0
(integer) 2
(0.65s)