mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
pkg/storage/redis: metrics updates (#1195)
* pkg/storage/redis: add metric to subscribe * pkg/storage/redis: fix pool stats nil pointer
This commit is contained in:
parent
f538b29a0c
commit
3f9a5f8c32
1 changed files with 3 additions and 2 deletions
|
@ -50,7 +50,6 @@ func New(rawURL, recordType string, deletePermanentAfter int64, opts ...Option)
|
|||
lastVersionKey: recordType + "_last_version",
|
||||
}
|
||||
|
||||
metrics.AddRedisMetrics(db.pool.Stats)
|
||||
for _, o := range opts {
|
||||
o(db)
|
||||
}
|
||||
|
@ -74,7 +73,7 @@ func New(rawURL, recordType string, deletePermanentAfter int64, opts ...Option)
|
|||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
metrics.AddRedisMetrics(db.pool.Stats)
|
||||
return db, nil
|
||||
}
|
||||
|
||||
|
@ -250,6 +249,7 @@ func (db *DB) doNotifyLoop(ctx context.Context, ch chan struct{}, psc *redis.Pub
|
|||
switch v := psc.Receive().(type) {
|
||||
case redis.Message:
|
||||
log.Debug().Str("action", string(v.Data)).Msg("got redis message")
|
||||
recordOperation(ctx, time.Now(), "sub_received", nil)
|
||||
if string(v.Data) != watchAction {
|
||||
continue
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ func (db *DB) doNotifyLoop(ctx context.Context, ch chan struct{}, psc *redis.Pub
|
|||
}
|
||||
case error:
|
||||
log.Warn().Err(v).Msg("failed to receive from redis channel")
|
||||
recordOperation(ctx, time.Now(), "sub_received", v)
|
||||
if _, ok := v.(net.Error); ok {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue