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