layer1: add live namespace counts
This commit is contained in:
@@ -123,6 +123,7 @@ func LogNamespaceManagerSummary(logger *zap.Logger, message string, summary Name
|
||||
}
|
||||
logger.Info(message,
|
||||
zap.Int("total_namespaces", summary.TotalNamespaces),
|
||||
zap.Int("live_namespaces", summary.LiveNamespaces),
|
||||
zap.Any("phase_counts", summary.PhaseCounts),
|
||||
zap.Any("source_counts", summary.SourceCounts),
|
||||
zap.Strings("subscribers", summary.Subscribers),
|
||||
@@ -258,6 +259,7 @@ func (m *inMemoryNamespaceManager) Summary() NamespaceManagerSummary {
|
||||
records := m.SnapshotRecords()
|
||||
summary := NamespaceManagerSummary{
|
||||
TotalNamespaces: len(records),
|
||||
LiveNamespaces: len(m.Snapshot()),
|
||||
PhaseCounts: make(map[NamespacePhase]int),
|
||||
SourceCounts: make(map[NamespaceSource]int),
|
||||
Subscribers: m.SnapshotSubscribers(),
|
||||
|
||||
@@ -75,6 +75,7 @@ type NamespaceEvent struct {
|
||||
|
||||
type NamespaceManagerSummary struct {
|
||||
TotalNamespaces int
|
||||
LiveNamespaces int
|
||||
PhaseCounts map[NamespacePhase]int
|
||||
SourceCounts map[NamespaceSource]int
|
||||
Subscribers []string
|
||||
|
||||
@@ -63,6 +63,9 @@ func TestNamespaceManagerSnapshotAndGet(t *testing.T) {
|
||||
if summary.TotalNamespaces != 2 {
|
||||
t.Fatalf("expected summary total namespaces to be 2, got %d", summary.TotalNamespaces)
|
||||
}
|
||||
if summary.LiveNamespaces != 2 {
|
||||
t.Fatalf("expected live namespaces to be 2, got %d", summary.LiveNamespaces)
|
||||
}
|
||||
if summary.SourceCounts[NamespaceSourceWatcher] != 2 {
|
||||
t.Fatalf("expected watcher source count to be 2")
|
||||
}
|
||||
@@ -467,6 +470,9 @@ func TestNamespaceManagerSummary(t *testing.T) {
|
||||
if summary.TotalNamespaces != 2 {
|
||||
t.Fatalf("expected total namespaces 2, got %d", summary.TotalNamespaces)
|
||||
}
|
||||
if summary.LiveNamespaces != 1 {
|
||||
t.Fatalf("expected one live namespace, got %d", summary.LiveNamespaces)
|
||||
}
|
||||
if summary.PhaseCounts[NamespacePhaseRegistering] != 1 {
|
||||
t.Fatalf("expected one registering namespace")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user