|
|
|
@ -39,6 +39,19 @@ import (
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
fileSDScanDuration = prometheus.NewSummary( |
|
|
|
|
prometheus.SummaryOpts{ |
|
|
|
|
Name: "prometheus_sd_file_scan_duration_seconds", |
|
|
|
|
Help: "The duration of the File-SD scan in seconds.", |
|
|
|
|
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
|
|
|
|
}) |
|
|
|
|
fileSDReadErrorsCount = prometheus.NewCounter( |
|
|
|
|
prometheus.CounterOpts{ |
|
|
|
|
Name: "prometheus_sd_file_read_errors_total", |
|
|
|
|
Help: "The number of File-SD read errors.", |
|
|
|
|
}) |
|
|
|
|
fileSDTimeStamp = NewTimestampCollector() |
|
|
|
|
|
|
|
|
|
patFileSDName = regexp.MustCompile(`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$`) |
|
|
|
|
|
|
|
|
|
// DefaultSDConfig is the default file SD configuration.
|
|
|
|
@ -49,6 +62,7 @@ var (
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
discovery.RegisterConfig(&SDConfig{}) |
|
|
|
|
prometheus.MustRegister(fileSDScanDuration, fileSDReadErrorsCount, fileSDTimeStamp) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SDConfig is the configuration for file based discovery.
|
|
|
|
@ -153,27 +167,6 @@ func NewTimestampCollector() *TimestampCollector {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
fileSDScanDuration = prometheus.NewSummary( |
|
|
|
|
prometheus.SummaryOpts{ |
|
|
|
|
Name: "prometheus_sd_file_scan_duration_seconds", |
|
|
|
|
Help: "The duration of the File-SD scan in seconds.", |
|
|
|
|
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
|
|
|
|
}) |
|
|
|
|
fileSDReadErrorsCount = prometheus.NewCounter( |
|
|
|
|
prometheus.CounterOpts{ |
|
|
|
|
Name: "prometheus_sd_file_read_errors_total", |
|
|
|
|
Help: "The number of File-SD read errors.", |
|
|
|
|
}) |
|
|
|
|
fileSDTimeStamp = NewTimestampCollector() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
prometheus.MustRegister(fileSDScanDuration) |
|
|
|
|
prometheus.MustRegister(fileSDReadErrorsCount) |
|
|
|
|
prometheus.MustRegister(fileSDTimeStamp) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Discovery provides service discovery functionality based
|
|
|
|
|
// on files that contain target groups in JSON or YAML format. Refreshing
|
|
|
|
|
// happens using file watches and periodic refreshes.
|
|
|
|
|