Skip to content

Commit

Permalink
Get repo from env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
chaspy committed Jan 24, 2021
1 parent 84e5d1d commit 889557c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type PR struct {
Labels []*github.Label
User *string
RequestedReviewers []*github.User
Repo string
}

func main() {
Expand Down Expand Up @@ -141,11 +142,14 @@ func getPRInfos(prs []*github.PullRequest) []PR {
prInfos := []PR{}

for _, pr := range prs {
repos := strings.Split(*pr.URL, "/")

prInfos = append(prInfos, PR{
Number: pr.Number,
Labels: pr.Labels,
User: pr.User.Login,
RequestedReviewers: pr.RequestedReviewers,
Repo: repos[4] + "/" + repos[5],
})
}

Expand Down Expand Up @@ -187,7 +191,7 @@ func generateCustomMetrics(prInfos []PR) ([]datadog.Metric, error) {
{datadog.Float64(nowF), datadog.Float64(countf)},
},
Type: datadog.String("gauge"),
Tags: append([]string{"number:" + strconv.Itoa(*prInfo.Number), "author:" + *prInfo.User, "repo:" + "quipper/kubernetes-clusters"}, labelAndReviewer...),
Tags: append([]string{"number:" + strconv.Itoa(*prInfo.Number), "author:" + *prInfo.User, "repo:" + prInfo.Repo}, labelAndReviewer...),
})
}

Expand Down

0 comments on commit 889557c

Please sign in to comment.