mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-11-10 14:44:04 +08:00
Rename the gauge to ntfy_topics_unifiedpush_total, next to ntfy_topics_total
This commit is contained in:
1 parent
68f0ea1279
commit
8d9e876c42
4 files changed
+9
-9
No files matched your search
+3
-3
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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()))
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
Reference in new issue
Block a user