DEV: only publish logs error count to admins

DEV: only publish logs error count to admins

From 1a71f98d28cdea692cca1b6e53f0258a8558c768 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Wed, 5 Dec 2018 17:03:37 +1100
Subject: [PATCH] DEV: only publish logs error count to admins


diff --git a/config/initializers/100-logster.rb b/config/initializers/100-logster.rb
index 6e607da..1ef50d2 100644
--- a/config/initializers/100-logster.rb
+++ b/config/initializers/100-logster.rb
@@ -94,7 +94,14 @@ RailsMultisite::ConnectionManagement.each_connection do
 
   if (error_rate_per_minute || 0) > 0
     store.register_rate_limit_per_minute(severities, error_rate_per_minute) do |rate|
-      MessageBus.publish("/logs_error_rate_exceeded", rate: rate, duration: 'minute', publish_at: Time.current.to_i)
+      MessageBus.publish("/logs_error_rate_exceeded",
+        {
+          rate: rate,
+          duration: 'minute',
+          publish_at: Time.current.to_i
+        },
+        group_ids: [Group::AUTO_GROUPS[:admins]]
+      )
     end
   end
 
@@ -102,7 +109,14 @@ RailsMultisite::ConnectionManagement.each_connection do
 
   if (error_rate_per_hour || 0) > 0
     store.register_rate_limit_per_hour(severities, error_rate_per_hour) do |rate|
-      MessageBus.publish("/logs_error_rate_exceeded", rate: rate, duration: 'hour', publish_at: Time.current.to_i)
+      MessageBus.publish("/logs_error_rate_exceeded",
+        {
+          rate: rate,
+          duration: 'hour',
+          publish_at: Time.current.to_i,
+        },
+        group_ids: [Group::AUTO_GROUPS[:admins]]
+      )
     end
   end
 end

GitHub

1 Like