Path: blob/main/component/loki/source/journal/internal/target/metrics.go
4096 views
package target12// This code is copied from Promtail with minor edits. The target package is used to3// configure and run the targets that can read journal entries and forward them4// to other loki components.56import "github.com/prometheus/client_golang/prometheus"78// Metrics holds a set of journal target metrics.9type Metrics struct {10reg prometheus.Registerer1112journalErrors *prometheus.CounterVec13journalLines prometheus.Counter14}1516// NewMetrics creates a new set of journal target metrics. If reg is non-nil, the17// metrics will be registered.18func NewMetrics(reg prometheus.Registerer) *Metrics {19var m Metrics20m.reg = reg2122m.journalErrors = prometheus.NewCounterVec(prometheus.CounterOpts{23Name: "loki_source_journal_target_parsing_errors_total",24Help: "Total number of parsing errors while reading journal messages",25}, []string{"error"})26m.journalLines = prometheus.NewCounter(prometheus.CounterOpts{27Name: "loki_source_journal_target_lines_total",28Help: "Total number of successful journal lines read",29})3031if reg != nil {32reg.MustRegister(33m.journalErrors,34m.journalLines,35)36}3738return &m39}404142