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/github] update metrics and attributes to match latest semantics and change scraper key name #36714

Merged
merged 22 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
83514ec
[receiver/github] add `vcs.repository.url.full` attribute
adrielp Dec 4, 2024
7d4eb20
[receiver/github] change repository.name to vcs.repository.name
adrielp Dec 6, 2024
0ff433f
[receiver/github] update ref.name and ref.type to match semconv
adrielp Dec 6, 2024
d26ad38
[receiver/github] update change.state to vcs.change.state
adrielp Dec 6, 2024
2e8b659
[receiver/github] convert rev behind and rev ahead to rev
adrielp Dec 6, 2024
cd4b56f
[receiver/github] update ref.time and ref.count metric names
adrielp Dec 6, 2024
2aaba53
[receiver/github] convert lines added and removed to lines_delta
adrielp Dec 6, 2024
98d509b
[receiver/github] update contributor count metric name
adrielp Dec 6, 2024
23e70de
Merge remote-tracking branch 'origin/main' into gh-semconv-1.28plus
adrielp Dec 7, 2024
41387d0
[receiver/github] add change.state and update time_open to duration
adrielp Dec 7, 2024
6fe2684
[chore] fix local generation
adrielp Dec 7, 2024
972890d
[receiver/github] remove repo from change state metrics and adjust attrs
adrielp Dec 7, 2024
6ec1e64
[chore] adjust type on genqlient uri
adrielp Dec 7, 2024
6debd25
[receiver/github] change scraper key from github to scraper
adrielp Dec 7, 2024
5e71341
[chore] update readme with new key
adrielp Dec 7, 2024
5a83e59
[chore] add changelog
adrielp Dec 7, 2024
9cdfc6c
[chore] checks
adrielp Dec 7, 2024
f0772db
[chore] add pr issue number to changelog
adrielp Dec 7, 2024
83a55c0
[chore] remove commented out import
adrielp Dec 7, 2024
167fef7
Merge branch 'main' into gh-semconv-1.28plus
adrielp Dec 9, 2024
d5daba7
Merge branch 'main' into gh-semconv-1.28plus
adrielp Dec 13, 2024
4dcb847
Merge branch 'main' into gh-semconv-1.28plus
adrielp Dec 13, 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
47 changes: 47 additions & 0 deletions .chloggen/gh-semconv-1.28plus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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: githubreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update metric names to match VCS Metric Semantic Conventions and scraper key name.

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

# (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: |
* Change the `github` scraper key to `scraper`
* Add `vcs.repository.url.full` attribute
* Change attribute `repository.name` to `vcs.repository.name`
* Change attribute `ref.name` to `vcs.ref.head.name`
* Change attribute `ref.type` to `vcs.ref.head.type`
* Change attribute `change.state` to `vcs.change.state`
* Add attribute `vcs.revision_delta.direction` with `ahead` and `behind` values
* Change metric `vcs.repository.ref.revisions_ahead` to `vcs.ref.revisions_delta` with `vcs.revision_delta.direction=ahead`
* Change metric `vcs.repository.ref.revisions_behind` to `vcs.ref.revisions_delta` with `vcs.revision_delta.direction=behind`
* Change metric `vcs.repository.ref.count` to `vcs.ref.count`
* Change metric `vcs.repository.ref.time` to `vcs.ref.time`
* Add attribute `vcs.line_change.type` with `added` and `removed` values
* Change metric `vcs.repository.ref.lines_added` to `vcs.ref.lines_delta` with `vcs.line_change.type=added`
* Change metric `vcs.repository.ref.lines_removed` to `vcs.ref.lines_delta` with `vcs.line_change.type=removed`
* Change metric `vcs.repository.contributor.count` to `vcs.contributor.count`
* Change metric `vcs.repository.change.time_open` to `vcs.change.duration` with `vcs.change.state=open`
* Change metric `vcs.repository.change.time_to_approval` to `vcs.change.time_to_approval`
* Change metric `vcs.repository.change.time_to_merge` to `vcs.change.time_to_merge`
* Change metric `vcs.repository.change.count` to `vcs.change.count`


# 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: [user]
6 changes: 3 additions & 3 deletions receiver/githubreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ The collection interval is common to all scrapers and is set to 30 seconds by de
github:
collection_interval: <duration> #default = 30s recommended 300s
scrapers:
<scraper1>:
<scraper2>:
scraper/config-1:
scraper/config-2:
...
```

Expand All @@ -55,7 +55,7 @@ receivers:
initial_delay: 1s
collection_interval: 60s
scrapers:
github:
scraper:
andrzej-stencel marked this conversation as resolved.
Show resolved Hide resolved
metrics:
vcs.repository.contributor.count:
enabled: true
Expand Down
4 changes: 2 additions & 2 deletions receiver/githubreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadConfig(t *testing.T) {
defaultConfigGitHubReceiver := factory.CreateDefaultConfig()

defaultConfigGitHubReceiver.(*Config).Scrapers = map[string]internal.Config{
metadata.Type.String(): (&githubscraper.Factory{}).CreateDefaultConfig(),
githubscraper.TypeStr: (&githubscraper.Factory{}).CreateDefaultConfig(),
}

defaultConfigGitHubReceiver.(*Config).WebHook = WebHook{
Expand All @@ -67,7 +67,7 @@ func TestLoadConfig(t *testing.T) {
InitialDelay: 1 * time.Second,
},
Scrapers: map[string]internal.Config{
metadata.Type.String(): (&githubscraper.Factory{}).CreateDefaultConfig(),
githubscraper.TypeStr: (&githubscraper.Factory{}).CreateDefaultConfig(),
},
WebHook: WebHook{
ServerConfig: confighttp.ServerConfig{
Expand Down
118 changes: 49 additions & 69 deletions receiver/githubreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metrics:
enabled: false
```

### vcs.repository.change.count
### vcs.change.count

The number of changes (pull requests) in a repository, categorized by their state (either open or merged).

Expand All @@ -24,12 +24,13 @@ The number of changes (pull requests) in a repository, categorized by their stat

| Name | Description | Values |
| ---- | ----------- | ------ |
| change.state | The state of a change (pull request) | Str: ``open``, ``merged`` |
| repository.name | The name of a VCS repository | Any Str |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.change.state | The state of a change (pull request) | Str: ``open``, ``merged`` |
| vcs.repository.name | The name of the VCS repository. | Any Str |

### vcs.repository.change.time_open
### vcs.change.duration

The amount of time a change (pull request) has been open.
The time duration a change (pull request/merge request/changelist) has been in an open state.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -39,10 +40,12 @@ The amount of time a change (pull request) has been open.

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |
| vcs.change.state | The state of a change (pull request) | Str: ``open``, ``merged`` |

### vcs.repository.change.time_to_approval
### vcs.change.time_to_approval

The amount of time it took a change (pull request) to go from open to approved.

Expand All @@ -54,10 +57,11 @@ The amount of time it took a change (pull request) to go from open to approved.

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |

### vcs.repository.change.time_to_merge
### vcs.change.time_to_merge

The amount of time it took a change (pull request) to go from open to merged.

Expand All @@ -69,18 +73,11 @@ The amount of time it took a change (pull request) to go from open to merged.

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |

### vcs.repository.count

The number of repositories in an organization.

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

### vcs.repository.ref.count
### vcs.ref.count

The number of refs of type branch in a repository.

Expand All @@ -92,28 +89,13 @@ The number of refs of type branch in a repository.

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |

### vcs.repository.ref.lines_added

The number of lines added in a ref (branch) relative to the default branch (trunk).

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

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.type | The type of the head reference (branch, tag). | Str: ``branch``, ``tag`` |

### vcs.repository.ref.lines_deleted
### vcs.ref.lines_delta

The number of lines deleted in a ref (branch) relative to the default branch (trunk).
The number of lines added/removed in a ref (branch) relative to the default branch (trunk).

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -123,13 +105,15 @@ The number of lines deleted in a ref (branch) relative to the default branch (tr

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |
| vcs.ref.head.type | The type of the head reference (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.line_change.type | The type of line change being measured on a ref (branch). | Str: ``added``, ``removed`` |

### vcs.repository.ref.revisions_ahead
### vcs.ref.revisions_delta

The number of revisions (commits) a ref (branch) is ahead of the default branch (trunk).
The number of revisions (commits) a ref (branch) is ahead/behind the branch from trunk (default).

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -139,41 +123,36 @@ The number of revisions (commits) a ref (branch) is ahead of the default branch

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |
| vcs.ref.head.type | The type of the head reference (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.revision_delta.direction | The type of revision comparison. | Str: ``ahead``, ``behind`` |

### vcs.repository.ref.revisions_behind
### vcs.ref.time

The number of revisions (commits) a ref (branch) is behind the default branch (trunk).
Time a ref (branch) created from the default branch (trunk) has existed. The `vcs.ref.head.type` attribute will always be `branch`.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {revision} | Gauge | Int |
| s | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |
| vcs.ref.head.name | The name of the VCS head reference (branch). | Any Str |
| vcs.ref.head.type | The type of the head reference (branch, tag). | Str: ``branch``, ``tag`` |

### vcs.repository.ref.time
### vcs.repository.count

Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`.
The number of repositories in an organization.

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

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| ref.name | The name of a VCS branch | Any Str |
| ref.type | The type of ref (branch, tag). | Str: ``branch``, ``tag`` |
| {repository} | Gauge | Int |

## Optional Metrics

Expand All @@ -185,7 +164,7 @@ metrics:
enabled: true
```

### vcs.repository.contributor.count
### vcs.contributor.count

The number of unique contributors to a repository.

Expand All @@ -197,7 +176,8 @@ The number of unique contributors to a repository.

| Name | Description | Values |
| ---- | ----------- | ------ |
| repository.name | The name of a VCS repository | Any Str |
| vcs.repository.url.full | The canonical URL of the repository providing the complete HTTPS address. | Any Str |
| vcs.repository.name | The name of the VCS repository. | Any Str |

## Resource Attributes

Expand Down
2 changes: 1 addition & 1 deletion receiver/githubreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (

var (
scraperFactories = map[string]internal.ScraperFactory{
metadata.Type.String(): &githubscraper.Factory{},
githubscraper.TypeStr: &githubscraper.Factory{},
}

errConfigNotValid = errors.New("configuration is not valid for the github receiver")
Expand Down
6 changes: 3 additions & 3 deletions receiver/githubreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ require (
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/grpc v1.68.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 // indirect
google.golang.org/grpc v1.68.1 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
12 changes: 6 additions & 6 deletions receiver/githubreceiver/go.sum

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

Loading
Loading