Beispiel #1
0
func collectClosedPullRequests(r repository.Repository) []Metric {
	pullRequests, err := r.PullRequests("closed", "updated")
	if err != nil {
		log.Logger.Fatalf(err.Error())
	}
	var items []Metric
	items = append(items, NewMetric("pull_requests.closed", map[string]interface{}{"count": len(pullRequests)}))
	items = append(items, collectPrs(pullRequests)...)
	return items
}
Beispiel #2
0
func collectOpenedPullRequests(r repository.Repository) []Metric {
	pullRequests, err := r.PullRequests("open", "updated")
	if err != nil {
		log.Logger.Fatalf(err.Error())
	}

	var items []Metric

	items = append(items, NewMetric("pull_requests.open", map[string]interface{}{"count": len(pullRequests)}))
	if len(pullRequests) > 0 {
		items = append(items, collectPrs(pullRequests)...)

		value := int(time.Since(pullRequests[0].UpdatedAt).Hours() / 24)
		items = append(items, NewMetric("pull_requests.least_recently_updated_days", map[string]interface{}{"count": value}))
	}

	return items
}