Example #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
}
Example #2
0
func collectClosedIssues(r repository.Repository) []Metric {
	issues, err := r.Issues("closed", "updated")
	if err != nil {
		log.Logger.Fatalf(err.Error())
	}
	var items []Metric
	items = append(items, NewMetric("issues.closed", map[string]interface{}{"count": len(issues)}))
	items = append(items, collectIssues(issues)...)
	return items
}
Example #3
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
}