Skip to content

Commit

Permalink
feat(refactor): update github receiver to use scraper as key (#580)
Browse files Browse the repository at this point in the history
```yaml
github:
  scrapers:
    github: ...
```

has now been changed to:

```yaml
github:
  scrapers:
    scraper: ..
```
  • Loading branch information
adrielp authored Oct 30, 2024
1 parent 27f5b2a commit d26719e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 67 deletions.
78 changes: 18 additions & 60 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,32 @@ receivers:
collection_interval: 60s
scrapers:
gitlab:
metrics:
#Default Metrics (enabled by default)
vcs.repository.count:
enabled: true
vcs.repository.change.count:
enabled: false
vcs.repository.change.time_open:
enabled: false
vcs.repository.change.time_to_approval:
enabled: false
vcs.repository.change.time_to_merge:
enabled: false
vcs.repository.ref.count:
enabled: false
vcs.repository.ref.lines_added:
enabled: false
vcs.repository.ref.lines_deleted:
enabled: false
vcs.repository.ref.revisions_ahead:
enabled: false
vcs.repository.ref.revisions_behind:
enabled: false
vcs.repository.ref.time:
enabled: false
#Optional Metrics
vcs.repository.contributor.count:
enabled: false
# Optionally enable or disable metrics
# metrics:
# Example
# vcs.repository.count:
# enabled: true
# ...
gitlab_org: ${env:GL_ORG}
#search_query: ${env:SEARCH_QUERY} #Recommended optional query override, defaults to "{org,user}:<github_org>"
#endpoint: https://selfmanagedenterpriseserver.com
# search_query: ${env:SEARCH_QUERY} #Recommended optional query override, defaults to "{org,user}:<github_org>"
# endpoint: https://selfmanagedenterpriseserver.com
auth:
authenticator: bearertokenauth/gitlab

github:
initial_delay: 10s
collection_interval: 60s
scrapers:
github:
metrics:
#Default Metrics (enabled by default)
vcs.repository.count:
enabled: true
vcs.repository.change.count:
enabled: false
vcs.repository.change.time_open:
enabled: false
vcs.repository.change.time_to_approval:
enabled: false
vcs.repository.change.time_to_merge:
enabled: false
vcs.repository.ref.count:
enabled: false
vcs.repository.ref.lines_added:
enabled: false
vcs.repository.ref.lines_deleted:
enabled: false
vcs.repository.ref.revisions_ahead:
enabled: false
vcs.repository.ref.revisions_behind:
enabled: false
vcs.repository.ref.time:
enabled: false
#Optional Metrics
vcs.repository.contributor.count:
enabled: false
scraper:
# Optionally enable or disable metrics
# metrics:
# Example
# vcs.repository.count:
# enabled: true
# ...
github_org: ${env:GH_ORG}
#search_query: ${env:SEARCH_QUERY} #Recommended optional query override, defaults to "{org,user}:<github_org>"
#endpoint: https://selfmanagedenterpriseserver.com
# search_query: ${env:SEARCH_QUERY} #Recommended optional query override, defaults to "{org,user}:<github_org>"
# endpoint: https://selfmanagedenterpriseserver.com
auth:
authenticator: bearertokenauth/github

Expand All @@ -102,6 +60,6 @@ service:
extensions: [bearertokenauth/github, bearertokenauth/gitlab]
pipelines:
metrics:
receivers: [gitlab]
receivers: [gitlab, github]
processors: []
exporters: [debug]
2 changes: 1 addition & 1 deletion extension/githubappauthextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ receivers:
initial_delay: 1s
collection_interval: 60s
scrapers:
github:
scraper:
metrics:
git.repository.contributor.count:
enabled: true
Expand Down
6 changes: 3 additions & 3 deletions receiver/githubreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,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/1:
scraper/2:
...
```

Expand All @@ -54,7 +54,7 @@ receivers:
initial_delay: 1s
collection_interval: 60s
scrapers:
github:
scraper:
metrics:
vcs.repository.contributor.count:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

const (
// TypeStr is the value of "type" key in configuration.
TypeStr = "github"
TypeStr = "scraper"
defaultHTTPTimeout = 15 * time.Second
)

Expand Down
4 changes: 2 additions & 2 deletions receiver/githubreceiver/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ receivers:
initial_delay: 1s
collection_interval: 60s
scrapers:
github:
scraper:

github/customname:
initial_delay: 1s
collection_interval: 30s
scrapers:
github:
scraper:

processors:
nop:
Expand Down

0 comments on commit d26719e

Please sign in to comment.