Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed valid_response to up #5

Merged
merged 1 commit into from
Apr 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const (
)

var (
// validResponse defines if the API response can get processed.
validResponse = prometheus.NewGauge(
// isUp defines if the API response can get processed.
isUp = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "valid_response",
Name: "up",
Help: "Check if Docker Hub response can be processed",
},
)
Expand All @@ -41,7 +41,7 @@ var (

// init just defines the initial state of the exports.
func init() {
validResponse.Set(0)
isUp.Set(0)
}

// NewExporter gives you a new exporter instance.
Expand All @@ -61,7 +61,7 @@ type Exporter struct {

// Describe defines the metric descriptions for Prometheus.
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
ch <- validResponse.Desc()
ch <- isUp.Desc()

for _, metric := range isAutomated {
ch <- metric.Desc()
Expand Down Expand Up @@ -92,13 +92,13 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
if err := e.scrape(); err != nil {
log.Error(err)

validResponse.Set(0)
ch <- validResponse
isUp.Set(0)
ch <- isUp

return
}

ch <- validResponse
ch <- isUp

for _, metric := range isAutomated {
ch <- metric
Expand Down Expand Up @@ -141,7 +141,7 @@ func (e *Exporter) scrape() error {
}
}

validResponse.Set(1)
isUp.Set(1)
return nil
}

Expand Down