Skip to content

Commit

Permalink
Run go fmt on all code
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelNdeCarvalho committed Dec 8, 2024
1 parent c863c49 commit a9befbc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cmd/aws_batch_exporter.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"github.com/atr0phy/aws_batch_exporter"
awsBatchExporter "github.com/atr0phy/aws_batch_exporter"
)

func main() {
awsBatchExporter.Run()
}
}
31 changes: 15 additions & 16 deletions collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
)

type Collector struct {
client batchiface.BatchAPI
region string
client batchiface.BatchAPI
region string
timeout time.Duration
}

const (
namespace = "aws_batch"
timeout = 10 * time.Second
timeout = 10 * time.Second
)

var (
Expand Down Expand Up @@ -69,7 +69,7 @@ var (
prometheus.BuildFQName(namespace, "", "failed_job"),
"Job in the queue that are in the FAILED state",
[]string{"region", "id", "queue", "name"}, nil,
)
)

jobSucceeded = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "succeeded_job"),
Expand All @@ -79,20 +79,19 @@ var (

jobDescMap = map[string]*prometheus.Desc{
batch.JobStatusSubmitted: jobSubmitted,
batch.JobStatusPending: jobPending,
batch.JobStatusRunnable: jobRunnable,
batch.JobStatusStarting: jobStarting,
batch.JobStatusRunning: jobRunning,
batch.JobStatusFailed: jobFailed,
batch.JobStatusPending: jobPending,
batch.JobStatusRunnable: jobRunnable,
batch.JobStatusStarting: jobStarting,
batch.JobStatusRunning: jobRunning,
batch.JobStatusFailed: jobFailed,
batch.JobStatusSucceeded: jobSucceeded,
}

)

type JobResult struct {
id string
queue string
name string
id string
queue string
name string
status string
}

Expand All @@ -103,8 +102,8 @@ func New(region string) (*Collector, error) {
}

return &Collector{
client: batch.New(s),
region: "ap-northeast-1",
client: batch.New(s),
region: "ap-northeast-1",
timeout: timeout,
}, nil
}
Expand Down Expand Up @@ -134,7 +133,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
defer wg.Done()
var results []JobResult
for _, s := range jobStatus {
r, err := c.client.ListJobsWithContext(ctx, &batch.ListJobsInput{JobQueue: d.JobQueueName,JobStatus: &s})
r, err := c.client.ListJobsWithContext(ctx, &batch.ListJobsInput{JobQueue: d.JobQueueName, JobStatus: &s})
if err != nil {
log.Printf("Error collecting job status metrics: %v\n", err)
continue
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ func Run() {
prometheus.MustRegister(collector)
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(addr, nil))
}
}

0 comments on commit a9befbc

Please sign in to comment.