Skip to content

Commit

Permalink
Merge pull request #5 from webhippie/2-rename-valid-response
Browse files Browse the repository at this point in the history
Renamed valid_response to up
  • Loading branch information
tboerger committed Apr 29, 2017
2 parents 483e4ce + ec9b8a5 commit 4a2a995
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit 4a2a995

Please sign in to comment.