Skip to content

Commit

Permalink
[receiver/gitproviderreceiver] updated metric namespaces (#31985)
Browse files Browse the repository at this point in the history
**Description:** Updated the metadata.yaml to include the changes
requested
[here](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/29642/files#diff-9186473f3b5d12c6f5880aefdb0fa79d88ffe57578b33a27c62b5eb7b5b10b74)
from @astencel-sumo

Combined `git.repository.pull_request.merged.count` and
`git.repository.pull_request.open.count` into
`git.repository.pull_request.count` with an attribute of
`pull_request_state` equal to `open` or `merged`

Renamed `git.repository.pull_request.open.time` to
`git.repository.pull_request.time_open`

Renamed `git.repository.pull_request.merged.time` to
`git.repository.pull_request.time_to_merge`

Renamed `git.repository.pull_request.approved.time` to
`git.repository.pull_request.time_to_approval`

**Link to tracking Issue:** None

**Testing:** The tests were updated to account for the changes.

**Documentation:** The docs were updated.

---------

Co-authored-by: Adriel Perkins <adrielp@liatrio.com>
  • Loading branch information
caseyw and adrielp authored Apr 11, 2024
1 parent 1c4836a commit 8c7ccd6
Show file tree
Hide file tree
Showing 12 changed files with 241 additions and 283 deletions.
31 changes: 31 additions & 0 deletions .chloggen/gitproviderreceiver-namespace-adjustments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use this changelog template to create an entry for release notes.

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

# 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: "Changed git provider metrics to better match conventions"

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

# (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: |
- Renamed `git.repository.pull_request.open.time` to `git.repository.pull_request.time_open`
- Renamed `git.repository.pull_request.merged.time` to `git.repository.pull_request.time_to_merge`
- Renamed `git.repository.pull_request.approved.time` to `git.repository.pull_request.time_to_approval`
- Combined `git.repository.pull_request.merged.count` and `git.repository.pull_request.open.count` into `git.repository.pull_request.count` with an attribute of `pull_request.state` equal to `open` or `merged`
# 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: []
7 changes: 3 additions & 4 deletions receiver/gitproviderreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ The current metrics available via scraping from GitHub are:
- [ ] Repository branch time
- [x] Repository branch count
- [x] Repository contributor count
- [x] Repository pull request open count
- [x] Repository pull request open time
- [x] Repository pull request merged count
- [x] Repository pull request merged time
- [x] Repository pull request approved time
- [x] Repository pull request time to merge
- [ ] Repository pull request deployment time
- [x] Repository pull request time to approval
- [x] Repository pull request count | stores an attribute of `pull_request.state` equal to `open` or `merged`

> Note: Some metrics may be disabled by default and have to be explicitly enabled.
> For example, the repository contributor count metric is one such metric. This is
Expand Down
35 changes: 11 additions & 24 deletions receiver/gitproviderreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,9 @@ Number of repositories in an organization
| ---- | ----------- | ---------- |
| {repository} | Gauge | Int |
### git.repository.pull_request.approved.time
### git.repository.pull_request.count
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
The number of pull requests in a repository, categorized by their state (either open or merged)
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -61,11 +46,12 @@ The number of merged pull requests in a repository
| Name | Description | Values |
| ---- | ----------- | ------ |
| pull_request.state | The state of a pull request | Str: ``open``, ``merged`` |
| repository.name | The name of a Git repository | Any Str |
### git.repository.pull_request.merged.time
### git.repository.pull_request.time_open
The amount of time it took a pull request to go from open to merged
The amount of time a pull request has been open
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -78,23 +64,24 @@ The amount of time it took a pull request to go from open to merged
| 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
### git.repository.pull_request.time_to_approval
The number of open pull requests in a repository
The amount of time it took a pull request to go from open to approved
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {pull_request} | Gauge | Int |
| 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.time
### git.repository.pull_request.time_to_merge
The amount of time a pull request has been open
The amount of time it took a pull request to go from open to merged
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand Down
4 changes: 2 additions & 2 deletions receiver/gitproviderreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ require (
go.opentelemetry.io/collector/processor v0.98.0 // indirect
go.opentelemetry.io/collector/service v0.98.0 // indirect
go.opentelemetry.io/contrib/config v0.4.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.25.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/bridge/opencensus v1.25.0 // indirect
Expand All @@ -111,7 +111,7 @@ require (
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
8 changes: 4 additions & 4 deletions receiver/gitproviderreceiver/go.sum

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

26 changes: 11 additions & 15 deletions receiver/gitproviderreceiver/internal/metadata/generated_config.go

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

0 comments on commit 8c7ccd6

Please sign in to comment.