FEATURE: Expose metric for missing post uploads count.

FEATURE: Expose metric for missing post uploads count.

diff --git a/plugin.rb b/plugin.rb
index 9a1ef65..06e65cd 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -76,20 +76,16 @@ after_initialize do
     metric.duration = stat.duration_ms * 0.001
     $prometheus_client.send_json metric.to_h
 
-    case stat.name
-    when "Jobs::EnsurePostUploadsExistence"
-      count = PostCustomField.where(name: Jobs::EnsurePostUploadsExistence::MISSING_UPLOADS).where.not(value: nil).count
-      $prometheus_client.send_json DiscoursePrometheus::InternalMetric::Custom.create_gauge_hash(
-        "missing_post_uploads",
-        "Number of missing uploads in all posts",
-        count
-      )
-    when "Jobs::EnsureS3UploadsExistence"
-      count = Discourse.stats.get("missing_s3_uploads") || -1
+    if stat.name == "Jobs::EnsureS3UploadsExistence"
       $prometheus_client.send_json DiscoursePrometheus::InternalMetric::Custom.create_gauge_hash(
         "missing_s3_uploads",
         "Number of missing uploads in S3",
-        count
+        Discourse.stats.get("missing_s3_uploads") || 0
+      )
+      $prometheus_client.send_json DiscoursePrometheus::InternalMetric::Custom.create_gauge_hash(
+        "missing_post_uploads",
+        "Number of missing post uploads",
+        Discourse.stats.get("missing_post_uploads") || 0
       )
     end
   end

GitHub sha: a9e85153