 # This is currently not used for anything except logging.
 TIME_HISTORY_LENGTH = 100
 
+# setup metrics
+metrics_recorder = require('./metrics-recorder')
+query_queue_exec = metrics_recorder.new_counter('query_queue_executed_total',
+                    'Executed queries and their status', ['status'])
+query_queue_duration = metrics_recorder.new_counter('query_queue_duration_seconds_total',
+                    'Total time it took to evaluate queries')
+query_queue_done = metrics_recorder.new_counter('query_queue_done_total',
+                    'Total number of evaluated queries')
+query_queue_count = metrics_recorder.new_gauge('queue_queue_count', 'Number of outstanding queries in the queue', ['client'])
+
 class exports.UserQueryQueue
     constructor: (opts) ->
         opts = defaults opts,

    destroy: =>
        delete @_do_query
        delete @_limit
        delete @_dbg
        delete @_state


            # point in even trying; the client likely already gave up.
            opts.cb?("timeout")
            cb()
            query_queue_exec.labels('timeout').inc()
            return

        @_dbg("_do_one_query(client_id='#{opts.client_id}') -- doing the query")
