Skip to content

Commit

Permalink
Merge pull request #520 from brotherlogic/fix_shutdown
Browse files Browse the repository at this point in the history
Adds counter on issue bounces
  • Loading branch information
brotherlogic committed Jul 26, 2020
2 parents 167a844 + bf359d1 commit 4d6b00e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions goserverapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,13 @@ func (s *GoServer) RaiseIssue(title, body string) {
}()
}

var issueBounces = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "server_bounces",
Help: "The number of server requests",
}, []string{"error"})

//BounceIssue raises an issue for a different source
func (s *GoServer) BounceIssue(ctx context.Context, title, body string, job string) {
func (s *GoServer) BounceIssue(title, body string, job string) {
s.AlertsFired++
go func() {
if !s.SkipLog {
Expand All @@ -1290,8 +1295,9 @@ func (s *GoServer) BounceIssue(ctx context.Context, title, body string, job stri
defer cancel()

_, err := client.AddIssue(ctx, &pbgh.Issue{Service: job, Title: title, Body: body}, grpc.FailFast(false))
issueBounces.With(prometheus.Labels{"error": fmt.Sprintf("%v", err)}).Inc()
if err != nil {
s.alertError = fmt.Sprintf("Failure to add issue: %v", err)
s.alertError = fmt.Sprintf("Failure to add issue: %v", err)
}
} else {
s.alertError = fmt.Sprintf("Cannot locate githubcard")
Expand Down

0 comments on commit 4d6b00e

Please sign in to comment.