From 8d9e876c42b3b3e63f35844d4a0d061467b78fa9 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sun, 1 Nov 2026 14:04:42 +0000 Subject: [PATCH] Rename the gauge to ntfy_topics_unifiedpush_total, next to ntfy_topics_total --- metrics/metrics.go | 6 +++--- metrics/metrics_test.go | 2 +- server/server_manager.go | 6 +++--- server/server_manager_test.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/metrics/metrics.go b/metrics/metrics.go index df4607af..6938c33c 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -75,8 +75,8 @@ var ( Topics = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "ntfy_topics_total", }) - UnifiedPushTopics = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "ntfy_unifiedpush_topics_total", + TopicsUnifiedPush = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "ntfy_topics_unifiedpush_total", }) HTTPRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "ntfy_http_requests_total", @@ -161,7 +161,7 @@ func init() { Users, Subscribers, Topics, - UnifiedPushTopics, + TopicsUnifiedPush, HTTPRequests, dbPools, ) diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index 4578437e..6cd2f68a 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -55,8 +55,8 @@ var expectedMetricNames = []string{ "ntfy_tail_messages_missed_total", "ntfy_tail_messages_read_total", "ntfy_topics_total", + "ntfy_topics_unifiedpush_total", "ntfy_unifiedpush_published_success", - "ntfy_unifiedpush_topics_total", "ntfy_users_total", "ntfy_visitors_total", } diff --git a/server/server_manager.go b/server/server_manager.go index 95d9517b..5fff8abc 100644 --- a/server/server_manager.go +++ b/server/server_manager.go @@ -85,7 +85,7 @@ func (s *Server) execManager() { // Update stats s.updateAndWriteStats(messagesCount) - unifiedPushTopics := s.topicService.Size() // UnifiedPush topics this node keeps, to watch their memory + topicsUnifiedPush := s.topicService.Size() // UnifiedPush topics this node keeps, to watch their memory // Log stats log. @@ -94,7 +94,7 @@ func (s *Server) execManager() { "messages_published": messagesCount, "messages_cached": messagesCached, "topics_active": topicsCount, - "unifiedpush_topics": unifiedPushTopics, + "topics_unifiedpush": topicsUnifiedPush, "subscribers": subscribers, "visitors": visitorsCount, "users": usersCount, @@ -111,7 +111,7 @@ func (s *Server) execManager() { metrics.Users.Set(float64(usersCount)) metrics.Subscribers.Set(float64(subscribers)) metrics.Topics.Set(float64(topicsCount)) - metrics.UnifiedPushTopics.Set(float64(unifiedPushTopics)) + metrics.TopicsUnifiedPush.Set(float64(topicsUnifiedPush)) if s.attachment != nil { metrics.AttachmentsTotalSize.Set(float64(s.attachment.Size())) } diff --git a/server/server_manager_test.go b/server/server_manager_test.go index bcbdc993..b3a47cb8 100644 --- a/server/server_manager_test.go +++ b/server/server_manager_test.go @@ -107,11 +107,11 @@ func TestServer_Manager_MessagesTotalSumsAcrossNodes(t *testing.T) { }) } -func TestServer_Manager_UnifiedPushTopicsGauge(t *testing.T) { +func TestServer_Manager_TopicsUnifiedPushGauge(t *testing.T) { // The manager exports how many UnifiedPush topics the node keeps in memory, to watch their memory s := newTestServer(t, newTestConfig(t, "")) s.topicService.SetRateVisitor("upAAAAAAAAAAAA", &tp.RateVisitor{IP: "1.2.3.4"}) s.topicService.Note("upBBBBBBBBBBBB") s.execManager() - require.Equal(t, float64(2), testutil.ToFloat64(metrics.UnifiedPushTopics)) + require.Equal(t, float64(2), testutil.ToFloat64(metrics.TopicsUnifiedPush)) }