Skip to content

Commit 3a3a844

Browse files
committed
Add requested_team tag
1 parent 23da993 commit 3a3a844

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ It has the following tags:
215215
- `draft` = `true` or `false`
216216
- `base_ref`
217217
- `head_ref`
218-
- `label` = label(s) of a pull request
219218
- `merged` = `true` or `false`
219+
- `requested_team` = team(s) of requested reviewer(s)
220+
- `label` = label(s) of a pull request
220221

221222
You can set `send-pull-request-labels` to use `label` tag in Datadog.
222223
If a pull request has multiple labels, this action sends the metrics for each label.

src/pullRequest/metrics.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,26 @@ export const computePullRequestClosedMetrics = (
136136
)
137137
}
138138

139+
// Datadog treats a tag as combination of values.
140+
// For example, if we send a metric with tags `label:foo` and `label:bar`, Datadog will show `label:foo,bar`.
141+
// Here send a metric for each tag
142+
let expanded: Series[] = series
143+
144+
expanded = expandSeriesByValues(
145+
expanded,
146+
'requested_team',
147+
e.pull_request.requested_teams.map((team) => team.name)
148+
)
149+
139150
if (options.sendPullRequestLabels) {
140-
// Datadog treats a tag as combination of values.
141-
// For example, if we send a metric with tags `label:foo` and `label:bar`, Datadog will show `label:foo,bar`.
142-
return expandSeriesByValues(series, 'label', e.pull_request.labels.map((l) => l.name))
151+
expanded = expandSeriesByValues(
152+
expanded,
153+
'label',
154+
e.pull_request.labels.map((l) => l.name)
155+
)
143156
}
144-
return series
157+
158+
return expanded
145159
}
146160

147161
const unixTime = (s: string): number => Date.parse(s) / 1000

0 commit comments

Comments
 (0)