Skip to content

Commit

Permalink
Add missed logs metric
Browse files Browse the repository at this point in the history
  • Loading branch information
ogtownsend committed Feb 21, 2024
1 parent b8e5bff commit 9168f9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/prommetrics"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)
Expand Down Expand Up @@ -417,6 +418,7 @@ func (r *logRecoverer) recoverFilter(ctx context.Context, f upkeepFilter, startB
added, alreadyPending, ok := r.populatePending(f, filteredLogs)
if added > 0 {
r.lggr.Debugw("found missed logs", "added", added, "alreadyPending", alreadyPending, "upkeepID", f.upkeepID)
prommetrics.AutomationRecovererMissedLogs.Add(float64(added))
}
if !ok {
r.lggr.Debugw("failed to add all logs to pending", "upkeepID", f.upkeepID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ import (
)

// AutomationNamespace is the namespace for all Automation related metrics
const AutomationNamespace = "automation"
const AutomationLogTriggerNamespace = "automation_log_trigger"

// Automation metrics
var (
AutomationLogsInLogBuffer = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: AutomationNamespace,
Namespace: AutomationLogTriggerNamespace,
Name: "num_logs_in_log_buffer",
Help: "The total number of logs currently being stored in the log buffer",
})
AutomationRecovererMissedLogs = promauto.NewCounter(prometheus.CounterOpts{
Namespace: AutomationLogTriggerNamespace,
Name: "num_recoverer_missed_logs",
Help: "How many valid log triggers were identified as being missed by the recoverer",
})
)

0 comments on commit 9168f9d

Please sign in to comment.