-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a54f600
commit 0e7b9d5
Showing
17 changed files
with
643 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package deduper | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
const ( | ||
promNamespace = "buildkite" | ||
promSubsystem = "deduper" | ||
) | ||
|
||
// Overridden by New to return len(inFlight). | ||
var jobsRunningGaugeFunc = func() int { return 0 } | ||
|
||
var ( | ||
_ = promauto.NewGaugeFunc(prometheus.GaugeOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "jobs_running", | ||
Help: "Current number of running jobs according to deduper", | ||
}, func() float64 { return float64(jobsRunningGaugeFunc()) }) | ||
|
||
jobHandlerCallsCounter = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "job_handler_calls_total", | ||
Help: "Count of jobs that were passed to the next handler in the chain", | ||
}) | ||
jobHandlerErrorCounter = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "job_handler_errors_total", | ||
Help: "Count of jobs that weren't scheduled because the next handler in the chain returned an error", | ||
}) | ||
|
||
onAddEventCounter = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "onadd_events_total", | ||
Help: "Count of OnAdd informer events", | ||
}) | ||
onUpdateEventCounter = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "onupdate_event_total", | ||
Help: "Count of OnUpdate informer events", | ||
}) | ||
onDeleteEventCounter = promauto.NewCounter(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "ondelete_events_total", | ||
Help: "Count of OnDelete informer events", | ||
}) | ||
|
||
jobsMarkedRunningCounter = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "jobs_marked_running_total", | ||
Help: "Count of times a job was added to inFlight", | ||
}, []string{"source"}) | ||
jobsUnmarkedRunningCounter = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "jobs_unmarked_running_total", | ||
Help: "Count of times a job was removed from inFlight", | ||
}, []string{"source"}) | ||
jobsAlreadyRunningCounter = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "jobs_already_running_total", | ||
Help: "Count of times a job was already present in inFlight", | ||
}, []string{"source"}) | ||
jobsAlreadyNotRunningCounter = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: promNamespace, | ||
Subsystem: promSubsystem, | ||
Name: "jobs_already_not_running_total", | ||
Help: "Count of times a job was already missing from inFlight", | ||
}, []string{"source"}) | ||
) |
Oops, something went wrong.