Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/gitproviderreceiver] add Pull Request metrics #29642

Merged
merged 49 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b1a3073
chore: fixed spelling error in comment
4lch4 Nov 28, 2023
ec26295
chore: formatted metadata.yaml
4lch4 Nov 28, 2023
f125a11
feat: added new metric definitions
4lch4 Nov 28, 2023
66b9e04
feat(helpers): added `getPullRequests` method
4lch4 Nov 28, 2023
a3d93f8
feat: added 2 remaining PR metrics
4lch4 Nov 28, 2023
a4f3768
feat: added logic for PR metrics
4lch4 Nov 28, 2023
2e534b4
format: reverted formatting change
4lch4 Nov 29, 2023
512ea83
format: removed extra commas
4lch4 Nov 29, 2023
8c28c4a
chore: removed unneeded comment
4lch4 Nov 29, 2023
592c053
feat: added `getAgeHrs` function
4lch4 Nov 29, 2023
ca2b691
chore: updated go.mod/sum
4lch4 Nov 29, 2023
8ad7097
revert: reverted a formatting change
4lch4 Nov 29, 2023
c9edcc4
test: added tests for new functionality
4lch4 Dec 4, 2023
445d009
Merge branch 'main' into more-github-metrics
4lch4 Dec 5, 2023
d029c1d
Merge branch 'main' into more-github-metrics
4lch4 Dec 5, 2023
1c9fa1f
refactor: renamed TestGetDurationHrs to TestGetAgeHrs
4lch4 Dec 6, 2023
f28b876
Update receiver/gitproviderreceiver/metadata.yaml
4lch4 Dec 9, 2023
5690a76
[chore] resolve conflicts for merge
4lch4 Dec 13, 2023
ce5daf0
[chore] fixed spelling mistake
4lch4 Dec 13, 2023
6e15de3
[chore] added changelog file
4lch4 Dec 13, 2023
dde2ae8
[chore] ran generate/docs commands
4lch4 Dec 13, 2023
e8a37e3
[refactor] getAgeHrs is now just getAge
4lch4 Dec 14, 2023
b195f96
[tests] added missing time.Duration for tests
4lch4 Dec 14, 2023
de56a20
[refactor] removed git.repository.pull_request.deployment.time metric
4lch4 Dec 14, 2023
7eacd6c
[refactor] updated metric descriptions and renamed for clarity
4lch4 Dec 14, 2023
33f8f79
[fix] updated function calls for new metric names
4lch4 Dec 14, 2023
09eb35b
[refactor] reworded description of repository.name
4lch4 Dec 14, 2023
11411ca
Apply suggestions from @adrielp in code review
4lch4 Dec 14, 2023
c7a887c
Apply suggestions from code review
4lch4 Dec 14, 2023
51d60b7
Merge branch 'main' into more-github-metrics
4lch4 Dec 21, 2023
eace02d
Apply suggestions @astencel-sumo made in code review
4lch4 Dec 22, 2023
95cc6a7
chore: updated deps and generated docs w/ new changes
4lch4 Dec 22, 2023
8e7e460
chore: updated go.mod & go.sum files
4lch4 Jan 5, 2024
d3e1739
chore: updated metrics in README
4lch4 Jan 5, 2024
9f0fa74
chore: updated metrics in README
4lch4 Jan 5, 2024
edaf4a1
chore: updated metric description in README
4lch4 Jan 5, 2024
c24b0e6
chore: updated metrics description in README
4lch4 Jan 5, 2024
e87b8dd
refactor: replaced unit names with numbers
4lch4 Jan 5, 2024
05deeb1
chore: updated deps and generated docs w/ new changes
4lch4 Jan 5, 2024
5287897
chore: reverting a reverted commit as it wasnt an issue
4lch4 Jan 9, 2024
50db4c0
chore: updated deps and generated docs w/ latest changes
4lch4 Jan 9, 2024
64dae8a
Merge branch 'main' into more-github-metrics
4lch4 Jan 9, 2024
566f247
Merge remote-tracking branch 'upstream/main' into more-github-metrics
4lch4 Jan 10, 2024
cffe1fc
[chore] fixed conflict and ran updates
4lch4 Jan 10, 2024
a25a83c
Merge branch 'main' into more-github-metrics
4lch4 Jan 15, 2024
a661096
Merge branch 'main' into more-github-metrics
4lch4 Jan 22, 2024
719d542
Merge branch 'main' into more-github-metrics
adrielp Feb 1, 2024
1e6321e
chore: run tidy
adrielp Feb 1, 2024
04aaffe
Merge branch 'main' into more-github-metrics
adrielp Feb 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .chloggen/more-github-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: gitproviderreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add pull request metrics

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [22028]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
- git.repository.pull_request.open.count
- git.repository.pull_request.open.time
- git.repository.pull_request.merged.count
- git.repository.pull_request.merged.time
- git.repository.pull_request.approved.time

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
8 changes: 5 additions & 3 deletions receiver/gitproviderreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ The current metrics available via scraping from GitHub are:
- [ ] Repository branch time
- [x] Repository branch count
- [x] Repository contributor count
- [ ] Repository pull request time
- [ ] Repository pull request merge time
- [ ] Repository pull request approval time
- [x] Repository pull request merge count
- [x] Repository pull request open count
- [x] Repository pull request time
- [x] Repository pull request merge time
4lch4 marked this conversation as resolved.
Show resolved Hide resolved
- [x] Repository pull request approval time
4lch4 marked this conversation as resolved.
Show resolved Hide resolved
- [ ] Repository pull request deployment time

> Note: Some metrics may be disabled by default and have to be explicitly enabled.
Expand Down
87 changes: 80 additions & 7 deletions receiver/gitproviderreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,98 @@ metrics:

### git.repository.branch.count

Number of branches in the repository
Number of branches in a repository

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |
| {branch} | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The full name of the Git repository | Any Str |
| repository.name | The name of a Git repository | Any Str |

### git.repository.count

Number of repositories in an organization

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |
| {repository} | Gauge | Int |

### git.repository.pull_request.approved.time

The amount of time it took a pull request to go from open to approved

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a Git repository | Any Str |
| branch.name | The name of a Git branch | Any Str |

### git.repository.pull_request.merged.count

The number of merged pull requests in a repository

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {pull_request} | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a Git repository | Any Str |

### git.repository.pull_request.merged.time

The amount of time it took a pull request to go from open to merged

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a Git repository | Any Str |
| branch.name | The name of a Git branch | Any Str |

### git.repository.pull_request.open.count

The number of open pull requests in a repository

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {pull_request} | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a Git repository | Any Str |

### git.repository.pull_request.open.time

The amount of time a pull request has been open

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a Git repository | Any Str |
| branch.name | The name of a Git branch | Any Str |

## Optional Metrics

Expand All @@ -46,17 +119,17 @@ metrics:

### git.repository.contributor.count

Total number of unique contributors to this repository
Total number of unique contributors to a repository

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |
| {contributor} | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The full name of the Git repository | Any Str |
| repository.name | The name of a Git repository | Any Str |

## Resource Attributes

Expand Down
8 changes: 4 additions & 4 deletions receiver/gitproviderreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down Expand Up @@ -107,9 +107,9 @@ require (
golang.org/x/text v0.14.0 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
18 changes: 9 additions & 9 deletions receiver/gitproviderreceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading