Skip to content

Commit c7c7ef9

Browse files
committed
Implement metrics in code
1 parent 6d898a1 commit c7c7ef9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

plugin/plugin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,12 @@ func (p *Plugin) invalidateDML(ctx context.Context, query string) {
276276
p.Logger.Debug("Failed to scan keys", "error", scanResult.Err())
277277
break
278278
}
279+
CacheScanCounter.Inc()
279280

280281
// Per each key, delete the cache entry and the table cache key itself.
281282
var keys []string
282283
keys, cursor = scanResult.Val()
284+
CacheScanKeysCounter.Add(float64(len(keys)))
283285
for _, tableKey := range keys {
284286
// Invalidate the cache for the table.
285287
cachedRespnseKey := strings.TrimPrefix(tableKey, table+":")

plugin/scheduler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ func (p *Plugin) PeriodicInvalidator() {
2828
p.Logger.Error("Failed to scan keys", "error", scanResult.Err())
2929
break
3030
}
31+
CacheScanCounter.Inc()
3132

3233
var addresses []string
3334
addresses, cursor = scanResult.Val()
35+
CacheScanKeysCounter.Add(float64(len(addresses)))
3436
for _, address := range addresses {
3537
valid := false
3638

0 commit comments

Comments
 (0)