From bf120dee187df22dfd9ac785a69977a9b409f957 Mon Sep 17 00:00:00 2001 From: Johannes Hertenstein Date: Mon, 21 Dec 2020 17:45:23 +0100 Subject: [PATCH] Add owning user to pull_request_count labels Resolves #30 --- exporter/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/metrics.go b/exporter/metrics.go index 3bd3c161..ee66c1b8 100644 --- a/exporter/metrics.go +++ b/exporter/metrics.go @@ -21,7 +21,7 @@ func AddMetrics() map[string]*prometheus.Desc { APIMetrics["PullRequestCount"] = prometheus.NewDesc( prometheus.BuildFQName("github", "repo", "pull_request_count"), "Total number of pull requests for given repository", - []string{"repo"}, nil, + []string{"repo", "user"}, nil, ) APIMetrics["Watchers"] = prometheus.NewDesc( prometheus.BuildFQName("github", "repo", "watchers"), @@ -85,7 +85,7 @@ func (e *Exporter) processMetrics(data []*Datum, rates *RateLimits, ch chan<- pr ch <- prometheus.MustNewConstMetric(e.APIMetrics["OpenIssues"], prometheus.GaugeValue, (x.OpenIssues - float64(prCount)), x.Name, x.Owner.Login, strconv.FormatBool(x.Private), strconv.FormatBool(x.Fork), strconv.FormatBool(x.Archived), x.License.Key, x.Language) // prCount - ch <- prometheus.MustNewConstMetric(e.APIMetrics["PullRequestCount"], prometheus.GaugeValue, float64(prCount), x.Name) + ch <- prometheus.MustNewConstMetric(e.APIMetrics["PullRequestCount"], prometheus.GaugeValue, float64(prCount), x.Name, x.Owner.Login) } // Set Rate limit stats