metrics: move Subsystem to constants

This commit is contained in:
2022-11-09 21:13:36 +02:00
parent db30464aef
commit 1218016ca1
4 changed files with 55 additions and 63 deletions

View File

@@ -6,35 +6,32 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
)
const promSubsystem = "watcher"
var (
promWatcherOnline = promauto.NewGauge(prom.GaugeOpts{
Namespace: globals.PrometheusPrefix,
Subsystem: "watcher",
Name: "online",
Help: "1 if initialized, and directory watcher has been engaged successfully",
Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
Name: "online",
Help: "1 if initialized, and directory watcher has been engaged successfully",
})
promWatcherErr = promauto.NewCounter(prom.CounterOpts{
Namespace: globals.PrometheusPrefix,
Subsystem: "watcher",
Name: "errors",
Help: "Error in logmower watching log files",
Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
Name: "errors",
Help: "Error in logmower watching log files",
})
promWatcherFilesStarted = promauto.NewCounter(prom.CounterOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "watcher",
Name: "log_file", // "discovered_logfiles",
Help: "Number of tracked log files",
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "log_file", // "discovered_logfiles",
Help: "Number of tracked log files",
})
promWatcherFilesSkipped = promauto.NewCounter(prom.CounterOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "watcher",
Name: "invalid_filename", // "skipped_files",
Help: "Number of files in log directory skipped due to unexpected filename",
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "invalid_filename", // "skipped_files",
Help: "Number of files in log directory skipped due to unexpected filename",
})
promWatcherEvents = promauto.NewCounter(prom.CounterOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "watcher",
Name: "inotify_event", // "events",
Help: "Number of events while watchng (includes initial create events for existing file discovery)",
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "inotify_event", // "events",
Help: "Number of events while watchng (includes initial create events for existing file discovery)",
})
)