File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2069,6 +2069,7 @@ func stopReplicationImpl(c *Core) error {
20692069func (c * Core ) emitMetrics (stopCh chan struct {}) {
20702070 emitTimer := time .Tick (time .Second )
20712071 writeTimer := time .Tick (c .counters .syncInterval )
2072+ identityCountTimer := time .Tick (time .Minute * 10 )
20722073
20732074 for {
20742075 select {
@@ -2094,6 +2095,17 @@ func (c *Core) emitMetrics(stopCh chan struct{}) {
20942095 }
20952096 }
20962097 c .stateLock .RUnlock ()
2098+ case <- identityCountTimer :
2099+ go func () {
2100+ ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
2101+ defer cancel ()
2102+ entities , err := c .countActiveEntities (ctx )
2103+ if err != nil {
2104+ c .logger .Error ("error counting identity entities" , "err" , err )
2105+ } else {
2106+ metrics .SetGauge ([]string {"identity" , "num_entities" }, float32 (entities .Entities .Total ))
2107+ }
2108+ }()
20972109
20982110 case <- stopCh :
20992111 return
You can’t perform that action at this time.
0 commit comments