Skip to content
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: 4 additions & 1 deletion app/log/loki/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
batchWait = 1 * time.Second
batchMax = 5 * 1 << 20 // 5MB
maxLogLineLen = 4 << 10 // 4096B
inputBuffer = 1000 // Buffered channel capacity for log lines
)

// lazyLabelsFunc abstracts lazy loading of labels, logs will only be sent when it returns true.
Expand Down Expand Up @@ -59,7 +60,7 @@ func newInternal(endpoint string, serviceLabel string, batchWait time.Duration,
endpoint: endpoint,
done: make(chan struct{}),
quit: make(chan struct{}),
input: make(chan string),
input: make(chan string, inputBuffer),
batchMax: batchMax,
batchWait: batchWait,
maxLogLineLen: maxLogLineLen,
Expand Down Expand Up @@ -156,6 +157,8 @@ func (c *Client) Add(line string) {
select {
case c.input <- line:
case <-c.quit:
default:
droppedTotal.Inc()
}
}

Expand Down
16 changes: 16 additions & 0 deletions app/log/loki/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright © 2022-2026 Obol Labs Inc. Licensed under the terms of a Business Source License 1.1

package loki

import (
"github.com/prometheus/client_golang/prometheus"

"github.com/obolnetwork/charon/app/promauto"
)

var droppedTotal = promauto.NewCounter(prometheus.CounterOpts{
Namespace: "app",
Subsystem: "log_loki",
Name: "dropped_total",
Help: "Total count of dropped log lines due to full buffer",
})
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ when storing metrics from multiple nodes or clusters in one Prometheus instance.
| `app_health_checks` | Gauge | Application health checks by name and severity. Set to 1 for failing, 0 for ok. | `severity, name` |
| `app_health_metrics_high_cardinality` | Gauge | Metrics with high cardinality by name. | `name` |
| `app_log_error_total` | Counter | Total count of logged errors by topic | `topic` |
| `app_log_loki_dropped_total` | Counter | Total count of dropped log lines due to full buffer | |
| `app_log_warn_total` | Counter | Total count of logged warnings by topic | `topic` |
| `app_monitoring_readyz` | Gauge | Set to 1 if the node is operational and monitoring api `/readyz` endpoint is returning 200s. Else `/readyz` is returning 500s and this metric is either set to 2 if the beacon node is down, or3 if the beacon node is syncing, or4 if quorum peers are not connected. | |
| `app_peer_name` | Gauge | Constant gauge with label set to the name of the cluster peer | `peer_name` |
Expand Down
Loading