FEATURE: track count of SQL calls per HTTP endpoint

FEATURE: track count of SQL calls per HTTP endpoint

diff --git a/lib/collector.rb b/lib/collector.rb
index db9ac31..d7d8207 100644
--- a/lib/collector.rb
+++ b/lib/collector.rb
@@ -211,6 +211,8 @@ module ::DiscoursePrometheus
         @http_sql_duration_seconds = Summary.new("http_sql_duration_seconds", "Time spent in HTTP reqs in SQL in seconds")
         @http_net_duration_seconds = Summary.new("http_net_duration_seconds", "Time spent in external network requests")
         @http_queue_duration_seconds = Summary.new("http_queue_duration_seconds", "Time spent queueing requests between NGINX and Ruby")
+
+        @http_sql_calls_per_request = Gauge.new("http_sql_calls_per_request", "How many SQL statements ran per request")
       end
     end
 
@@ -232,6 +234,8 @@ module ::DiscoursePrometheus
       @http_net_duration_seconds.observe(metric.net_duration, labels)
       @http_queue_duration_seconds.observe(metric.queue_duration, labels)
 
+      @http_sql_calls_per_request.observe(metric.sql_calls, labels.merge(logged_in: metric.logged_in))
+
       db = metric.db || "default"
 
       if metric.tracked
@@ -335,7 +339,7 @@ module ::DiscoursePrometheus
         [@page_views, @http_requests, @http_duration_seconds,
           @http_redis_duration_seconds, @http_sql_duration_seconds,
           @http_net_duration_seconds, @http_queue_duration_seconds,
-          @http_forced_anon_count
+          @http_forced_anon_count, @http_sql_calls_per_request
         ]
       else
         []

GitHub sha: 4fd28fda