FIX: Backwards compatibility with Discourse `stable` branch.

FIX: Backwards compatibility with Discourse stable branch.

diff --git a/lib/internal_metric/global.rb b/lib/internal_metric/global.rb
index 9e5240a..d09bbdc 100644
--- a/lib/internal_metric/global.rb
+++ b/lib/internal_metric/global.rb
@@ -148,13 +148,15 @@ module DiscoursePrometheus::InternalMetric
     end
 
     def missing_uploads(type)
-      missing = {}
+      if Discourse.respond_to?(:stats)
+        missing = {}
 
-      RailsMultisite::ConnectionManagement.each_connection do |db|
-        missing[{ db: db }] = Discourse.stats.get("missing_#{type}_uploads")
-      end
+        RailsMultisite::ConnectionManagement.each_connection do |db|
+          missing[{ db: db }] = Discourse.stats.get("missing_#{type}_uploads")
+        end
 
-      missing
+        missing
+      end
     end
   end
 end

GitHub sha: ab80cce3