Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split log buffer flow metric into two metrics #12444

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading