Rename the gauge to ntfy_topics_unifiedpush_total, next to ntfy_topics_total

This commit is contained in:
binwiederhier committed 2026-11-01 14:04:42 +00:00
1 parent 68f0ea1279
commit 8d9e876c42
4 files changed
+9 -9

No files matched your search

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