metrics: move Subsystem to constants
This commit is contained in:
		| @@ -6,28 +6,26 @@ import ( | |||||||
| 	"github.com/prometheus/client_golang/prometheus/promauto" | 	"github.com/prometheus/client_golang/prometheus/promauto" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const promSubsystem = "file" | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	promFileInitialSeekSkipped = promauto.NewGaugeVec(prometheus.GaugeOpts{ | 	promFileInitialSeekSkipped = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "file", | 		Name:      "skipped_bytes", | ||||||
| 		Name: "skipped_bytes", | 		Help:      "Bytes skipped in file after discovering", | ||||||
| 		Help: "Bytes skipped in file after discovering", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promFileCatchupDone = promauto.NewGaugeVec(prometheus.GaugeOpts{ | 	promFileCatchupDone = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "file", | 		Name: "catchupped", | ||||||
| 		Name:      "catchupped", | 		Help: "(0 or) 1 if initial backlog has been sent; (total <= watcher_file_count)", | ||||||
| 		Help:      "(0 or) 1 if initial backlog has been sent; (total <= watcher_file_count)", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promFileErr = promauto.NewCounterVec(prometheus.CounterOpts{ | 	promFileErr = promauto.NewCounterVec(prometheus.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "file", | 		Name: "errors_count", | ||||||
| 		Name:      "errors_count", | 		Help: "Errors while reading file", | ||||||
| 		Help:      "Errors while reading file", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promFileLineSize = promauto.NewHistogramVec(prometheus.HistogramOpts{ | 	promFileLineSize = promauto.NewHistogramVec(prometheus.HistogramOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "file", |  | ||||||
| 		Name:    "line_size_bytes", | 		Name:    "line_size_bytes", | ||||||
| 		Help:    "Log line size in bytes", | 		Help:    "Log line size in bytes", | ||||||
| 		Buckets: []float64{80, 160, 320, 640, 1280}, | 		Buckets: []float64{80, 160, 320, 640, 1280}, | ||||||
|   | |||||||
| @@ -6,18 +6,18 @@ import ( | |||||||
| 	"github.com/prometheus/client_golang/prometheus/promauto" | 	"github.com/prometheus/client_golang/prometheus/promauto" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const promSubsystem = "record" | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	promRecordDroppedTooLarge = promauto.NewCounterVec(prom.CounterOpts{ | 	promRecordDroppedTooLarge = promauto.NewCounterVec(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "record", | 		Name:      "dropped_lines",          // "dropped", | ||||||
| 		Name: "dropped_lines", // "dropped", | 		Help:      "Records dropped due to being too large", | ||||||
| 		Help: "Records dropped due to being too large", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
|  |  | ||||||
| 	promRecordPrefixParsingErr = promauto.NewCounterVec(prom.CounterOpts{ | 	promRecordPrefixParsingErr = promauto.NewCounterVec(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "record", | 		Name: "parsing_errors", | ||||||
| 		Name:      "parsing_errors", | 		Help: "Errors while parsing log line prefixes", | ||||||
| 		Help:      "Errors while parsing log line prefixes", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -6,36 +6,33 @@ import ( | |||||||
| 	"github.com/prometheus/client_golang/prometheus/promauto" | 	"github.com/prometheus/client_golang/prometheus/promauto" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const promSubsystem = "shipper" | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	promShipperQueued = promauto.NewGaugeVec(prometheus.GaugeOpts{ | 	promShipperQueued = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "shipper", | 		Name:      "shipper_record",         // "queued", | ||||||
| 		Name: "shipper_record", //      "queued", | 		Help:      "Log records in queue to be batched and sent to database", | ||||||
| 		Help: "Log records in queue to be batched and sent to database", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promShipperDbSent = promauto.NewCounterVec(prometheus.CounterOpts{ | 	promShipperDbSent = promauto.NewCounterVec(prometheus.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "shipper", | 		Name:      "record",                 // "sent", | ||||||
| 		Name: "record", // "sent", | 		Help:      "Log records successfully committed to database", | ||||||
| 		Help: "Log records successfully committed to database", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promShipperBatchSizeResult = promauto.NewHistogram(prometheus.HistogramOpts{ | 	promShipperBatchSizeResult = promauto.NewHistogram(prometheus.HistogramOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix,  // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "shipper", | 		Name:      "bulk_submission_message", // "items_in_batch" | ||||||
| 		Name:    "bulk_submission_message", // "items_in_batch" | 		Help:      "Batch size for database submissions", | ||||||
| 		Help:    "Batch size for database submissions", | 		Buckets:   []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000}, | ||||||
| 		Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000}, |  | ||||||
| 	}) | 	}) | ||||||
| 	promShipperDbSendError = promauto.NewCounterVec(prometheus.CounterOpts{ | 	promShipperDbSendError = promauto.NewCounterVec(prometheus.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "shipper", | 		Name:      "insertion_error",        // "errors", | ||||||
| 		Name: "insertion_error", // "errors", | 		Help:      "Failed database bulk insertions", | ||||||
| 		Help: "Failed database bulk insertions", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| 	promShipperSynced = promauto.NewGaugeVec(prometheus.GaugeOpts{ | 	promShipperSynced = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "shipper", | 		Name: "batches_synced", | ||||||
| 		Name:      "batches_synced", | 		Help: "All batches available have been committed database (0 or 1)", | ||||||
| 		Help:      "All batches available have been committed database (0 or 1)", |  | ||||||
| 	}, []string{"filename"}) | 	}, []string{"filename"}) | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -6,35 +6,32 @@ import ( | |||||||
| 	"github.com/prometheus/client_golang/prometheus/promauto" | 	"github.com/prometheus/client_golang/prometheus/promauto" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const promSubsystem = "watcher" | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	promWatcherOnline = promauto.NewGauge(prom.GaugeOpts{ | 	promWatcherOnline = promauto.NewGauge(prom.GaugeOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "watcher", | 		Name: "online", | ||||||
| 		Name:      "online", | 		Help: "1 if initialized, and directory watcher has been engaged successfully", | ||||||
| 		Help:      "1 if initialized, and directory watcher has been engaged successfully", |  | ||||||
| 	}) | 	}) | ||||||
| 	promWatcherErr = promauto.NewCounter(prom.CounterOpts{ | 	promWatcherErr = promauto.NewCounter(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem, | ||||||
| 		Subsystem: "watcher", | 		Name: "errors", | ||||||
| 		Name:      "errors", | 		Help: "Error in logmower watching log files", | ||||||
| 		Help:      "Error in logmower watching log files", |  | ||||||
| 	}) | 	}) | ||||||
| 	promWatcherFilesStarted = promauto.NewCounter(prom.CounterOpts{ | 	promWatcherFilesStarted = promauto.NewCounter(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "watcher", | 		Name:      "log_file",               // "discovered_logfiles", | ||||||
| 		Name: "log_file", // "discovered_logfiles", | 		Help:      "Number of tracked log files", | ||||||
| 		Help: "Number of tracked log files", |  | ||||||
| 	}) | 	}) | ||||||
| 	promWatcherFilesSkipped = promauto.NewCounter(prom.CounterOpts{ | 	promWatcherFilesSkipped = promauto.NewCounter(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "watcher", | 		Name:      "invalid_filename",       // "skipped_files", | ||||||
| 		Name: "invalid_filename", // "skipped_files", | 		Help:      "Number of files in log directory skipped due to unexpected filename", | ||||||
| 		Help: "Number of files in log directory skipped due to unexpected filename", |  | ||||||
| 	}) | 	}) | ||||||
| 	promWatcherEvents = promauto.NewCounter(prom.CounterOpts{ | 	promWatcherEvents = promauto.NewCounter(prom.CounterOpts{ | ||||||
| 		Namespace: globals.PrometheusPrefix, | 		Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem, | ||||||
| 		// Subsystem: "watcher", | 		Name:      "inotify_event",          // "events", | ||||||
| 		Name: "inotify_event", // "events", | 		Help:      "Number of events while watchng (includes initial create events for existing file discovery)", | ||||||
| 		Help: "Number of events while watchng (includes initial create events for existing file discovery)", |  | ||||||
| 	}) | 	}) | ||||||
| ) | ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user