Skip to content

Commit

Permalink
Split log buffer flow metric into two metrics (#12444)
Browse files Browse the repository at this point in the history
* Split log buffer flow metric into two metrics

* Add changeset

* Differentiate dropped from egress/dequeued
  • Loading branch information
ogtownsend committed Apr 1, 2024
1 parent bc4fbbd commit dde7fdf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-horses-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Updating prometheus metrics for Automation log triggers
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ func (b *logEventBuffer) enqueue(id *big.Int, logs ...logpoller.Log) int {
}
if added > 0 {
lggr.Debugw("Added logs to buffer", "addedLogs", added, "dropped", dropped, "latestBlock", latestBlock)
prommetrics.AutomationLogsInLogBuffer.Add(float64(added - dropped))
prommetrics.AutomationLogBufferFlow.WithLabelValues(prommetrics.LogBufferFlowDirectionIngress).Add(float64(added))
prommetrics.AutomationLogBufferFlow.WithLabelValues(prommetrics.LogBufferFlowDirectionDropped).Add(float64(dropped))
}

return added - dropped
Expand Down Expand Up @@ -333,7 +334,7 @@ func (b *logEventBuffer) dequeueRange(start, end int64, upkeepLimit, totalLimit

if len(results) > 0 {
b.lggr.Debugw("Dequeued logs", "results", len(results), "start", start, "end", end)
prommetrics.AutomationLogsInLogBuffer.Sub(float64(len(results)))
prommetrics.AutomationLogBufferFlow.WithLabelValues(prommetrics.LogBufferFlowDirectionEgress).Add(float64(len(results)))
}

return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ import (
// AutomationNamespace is the namespace for all Automation related metrics
const AutomationLogTriggerNamespace = "automation_log_trigger"

// Metric labels
const (
LogBufferFlowDirectionIngress = "ingress"
LogBufferFlowDirectionEgress = "egress"
LogBufferFlowDirectionDropped = "dropped"
)

// Automation metrics
var (
AutomationLogsInLogBuffer = promauto.NewGauge(prometheus.GaugeOpts{
AutomationLogBufferFlow = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: AutomationLogTriggerNamespace,
Name: "num_logs_in_log_buffer",
Help: "The total number of logs currently being stored in the log buffer",
}, []string{
"direction",
})
AutomationRecovererMissedLogs = promauto.NewCounter(prometheus.CounterOpts{
Namespace: AutomationLogTriggerNamespace,
Expand Down

0 comments on commit dde7fdf

Please sign in to comment.