diff --git a/metrics/metrics.go b/metrics/metrics.go index dfc0af79..df4607af 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -75,8 +75,8 @@ var ( Topics = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "ntfy_topics_total", }) - TopicStates = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "ntfy_topic_states_total", + UnifiedPushTopics = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "ntfy_unifiedpush_topics_total", }) HTTPRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "ntfy_http_requests_total", @@ -161,7 +161,7 @@ func init() { Users, Subscribers, Topics, - TopicStates, + UnifiedPushTopics, HTTPRequests, dbPools, ) diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index 75bbb54b..4578437e 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -54,9 +54,9 @@ var expectedMetricNames = []string{ "ntfy_tail_messages_lag_seconds", "ntfy_tail_messages_missed_total", "ntfy_tail_messages_read_total", - "ntfy_topic_states_total", "ntfy_topics_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 edb857ce..95d9517b 100644 --- a/server/server_manager.go +++ b/server/server_manager.go @@ -85,7 +85,7 @@ func (s *Server) execManager() { // Update stats s.updateAndWriteStats(messagesCount) - topicStates := s.topicService.Size() // UnifiedPush topics this node keeps, to watch their memory + unifiedPushTopics := 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, - "topic_states": topicStates, + "unifiedpush_topics": unifiedPushTopics, "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.TopicStates.Set(float64(topicStates)) + metrics.UnifiedPushTopics.Set(float64(unifiedPushTopics)) 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 b8c65352..bcbdc993 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_TopicStatesGauge(t *testing.T) { - // The manager exports how many topic states the node keeps in memory, to watch their memory +func TestServer_Manager_UnifiedPushTopicsGauge(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.TopicStates)) + require.Equal(t, float64(2), testutil.ToFloat64(metrics.UnifiedPushTopics)) }