From fd91f6b203ddb6d1c1383485832798e4d9a1d543 Mon Sep 17 00:00:00 2001 From: Simon Tucker Date: Sun, 26 Jul 2020 11:16:01 -0700 Subject: [PATCH] Adds counter on issue bounces --- goserverapi.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/goserverapi.go b/goserverapi.go index e2b5183..4d14e6c 100644 --- a/goserverapi.go +++ b/goserverapi.go @@ -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 { @@ -1290,6 +1295,7 @@ 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) }