Rename the gauge to ntfy_unifiedpush_topics_total

This commit is contained in:
binwiederhier committed 2026-11-01 14:04:20 +00:00
1 parent 18cdc09698
commit 68f0ea1279
4 files changed
+10 -10

No files matched your search

+3 -3
View File
@@ -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,
)
+1 -1
View File
@@ -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",
}
+3 -3
View File
@@ -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()))
}
+3 -3
View File
@@ -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))
}