@@ -18,6 +18,11 @@ func AddMetrics() map[string]*prometheus.Desc {
1818 "Total number of open issues for given repository" ,
1919 []string {"repo" , "user" , "private" , "fork" , "archived" , "license" , "language" }, nil ,
2020 )
21+ APIMetrics ["PullRequestCount" ] = prometheus .NewDesc (
22+ prometheus .BuildFQName ("github" , "repo" , "pull_request_count" ),
23+ "Total number of pull requests for given repository" ,
24+ []string {"repo" }, nil ,
25+ )
2126 APIMetrics ["Watchers" ] = prometheus .NewDesc (
2227 prometheus .BuildFQName ("github" , "repo" , "watchers" ),
2328 "Total number of watchers/subscribers for given repository" ,
@@ -64,7 +69,6 @@ func (e *Exporter) processMetrics(data []*Datum, rates *RateLimits, ch chan<- pr
6469 for _ , x := range data {
6570 ch <- prometheus .MustNewConstMetric (e .APIMetrics ["Stars" ], prometheus .GaugeValue , x .Stars , x .Name , x .Owner .Login , strconv .FormatBool (x .Private ), strconv .FormatBool (x .Fork ), strconv .FormatBool (x .Archived ), x .License .Key , x .Language )
6671 ch <- prometheus .MustNewConstMetric (e .APIMetrics ["Forks" ], prometheus .GaugeValue , x .Forks , x .Name , x .Owner .Login , strconv .FormatBool (x .Private ), strconv .FormatBool (x .Fork ), strconv .FormatBool (x .Archived ), x .License .Key , x .Language )
67- ch <- prometheus .MustNewConstMetric (e .APIMetrics ["OpenIssues" ], prometheus .GaugeValue , x .OpenIssues , x .Name , x .Owner .Login , strconv .FormatBool (x .Private ), strconv .FormatBool (x .Fork ), strconv .FormatBool (x .Archived ), x .License .Key , x .Language )
6872 ch <- prometheus .MustNewConstMetric (e .APIMetrics ["Watchers" ], prometheus .GaugeValue , x .Watchers , x .Name , x .Owner .Login , strconv .FormatBool (x .Private ), strconv .FormatBool (x .Fork ), strconv .FormatBool (x .Archived ), x .License .Key , x .Language )
6973 ch <- prometheus .MustNewConstMetric (e .APIMetrics ["Size" ], prometheus .GaugeValue , x .Size , x .Name , x .Owner .Login , strconv .FormatBool (x .Private ), strconv .FormatBool (x .Fork ), strconv .FormatBool (x .Archived ), x .License .Key , x .Language )
7074
@@ -73,6 +77,15 @@ func (e *Exporter) processMetrics(data []*Datum, rates *RateLimits, ch chan<- pr
7377 ch <- prometheus .MustNewConstMetric (e .APIMetrics ["ReleaseDownloads" ], prometheus .GaugeValue , float64 (asset .Downloads ), x .Name , x .Owner .Login , release .Name , asset .Name , asset .CreatedAt )
7478 }
7579 }
80+ prCount := 0
81+ for range x .Pulls {
82+ prCount += 1
83+ }
84+ // issueCount = x.OpenIssue - prCount
85+ 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 )
86+
87+ // prCount
88+ ch <- prometheus .MustNewConstMetric (e .APIMetrics ["PullRequestCount" ], prometheus .GaugeValue , float64 (prCount ), x .Name )
7689 }
7790
7891 // Set Rate limit stats
0 commit comments