SidekiqQueue: report only configured queues (#126)

SidekiqQueue: report only configured queues (#126)

Closes #125.

diff --git a/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb b/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb
index e666e2c..63b4ce5 100644
--- a/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb
+++ b/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb
@@ -27,13 +27,24 @@ module PrometheusExporter::Instrumentation
     end
 
     def collect_queue_stats
+      hostname = Socket.gethostname
+      pid = ::Process.pid
+      ps = ::Sidekiq::ProcessSet.new
+
+      process = ps.find do |sp|
+        sp['hostname'] == hostname && sp['pid'] == pid
+      end
+
+      queues = process.nil? ? [] : process['queues']
+
       ::Sidekiq::Queue.all.map do |queue|
+        next unless queues.include? queue.name
         {
           backlog_total: queue.size,
           latency_seconds: queue.latency.to_i,
           labels: { queue: queue.name }
         }
-      end
+      end.compact
     end
   end
 end

GitHub sha: 90820ac6

This commit appears in #126 which was merged by SamSaffron.