Skip to content

Commit

Permalink
Have distinct Prometheus metrics for start and end times
Browse files Browse the repository at this point in the history
This will need clocks to be synced on the workers....
  • Loading branch information
mulbc committed Jun 12, 2020
1 parent d391160 commit 5e31ac5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions worker/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ var svc, housekeepingSvc *s3.S3
var ctx context.Context
var hc *http.Client
var promRegistry = prom.NewRegistry()
var promTestGauge = prom.NewGaugeVec(
var promTestStartGauge = prom.NewGaugeVec(
prom.GaugeOpts{
Name: "test_in_progress",
Name: "test_start",
Namespace: "gosbench",
Help: "Determines if a job is in progress for Grafana annotations",
Help: "Determines the start time of a job for Grafana annotations",
}, []string{"testName"})
var promTestEndGauge = prom.NewGaugeVec(
prom.GaugeOpts{
Name: "test_end",
Namespace: "gosbench",
Help: "Determines the end time of a job for Grafana annotations",
}, []string{"testName"})

func init() {
Expand All @@ -47,9 +53,13 @@ func init() {
log.WithError(err).Fatalf("Failed to create the Prometheus exporter:")
}

err = promRegistry.Register(promTestGauge)
err = promRegistry.Register(promTestStartGauge)
if err != nil {
log.WithError(err).Error("Issues when adding test_start gauge to Prometheus registry")
}
err = promRegistry.Register(promTestEndGauge)
if err != nil {
log.WithError(err).Error("Issues when adding test_in_progress gauge to Prometheus registry")
log.WithError(err).Error("Issues when adding test_end gauge to Prometheus registry")
}

if err := view.Register([]*view.View{
Expand Down

0 comments on commit 5e31ac5

Please sign in to comment.