Skip to content

Commit

Permalink
[chore] update comment and readme based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielp committed May 10, 2024
1 parent 194c68c commit f0370b5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
69 changes: 34 additions & 35 deletions receiver/gitproviderreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,6 @@ The current default set of metrics common across all vendors can be found in [do

These default metrics can be used as leading indicators to the DORA metrics; helping provide insight into modern-day engineering practices.

## GitHub Scraper

> Important:
> * The GitHub scraper does not emit metrics for branches that have not had
> changes since creation from the default branch (trunk).
> * Due to GitHub API limitations, it is possible for the branch time metric to
> change when rebases occur, recreating the commits with new timestamps.

For additional context on GitHub scraper limitations and inner workings please
see the [GitHub Scraper README][ghsread].

[ghsread]: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/gitproviderreceiver/internal/scraper/githubscraper/README.md#github-limitations


The current metrics available via scraping from GitHub are:

- [x] Repository count
- [x] Repository contributor count
- [x] Repository branch count
- [x] Repository branch time
- [x] Repository branch commit aheadby count
- [x] Repository branch commit behindby count
- [x] Repository branch line addition count
- [x] Repository branch line deletion count
- [x] Repository pull request open time
- [x] Repository pull request time to merge
- [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
> because this metric relies on the REST API which is subject to lower rate limits.

## Getting Started

The collection interval is common to all scrapers and is set to 30 seconds by default.
Expand Down Expand Up @@ -111,3 +76,37 @@ The available scrapers are:
| Scraper | Description |
|----------|-------------------------|
| [github] | Git Metrics from [GitHub](https://github.com/) |
## GitHub Scraper
> Important:
> * The GitHub scraper does not emit metrics for branches that have not had
> changes since creation from the default branch (trunk).
> * Due to GitHub API limitations, it is possible for the branch time metric to
> change when rebases occur, recreating the commits with new timestamps.
For additional context on GitHub scraper limitations and inner workings please
see the [GitHub Scraper README][ghsread].
[ghsread]: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/gitproviderreceiver/internal/scraper/githubscraper/README.md#github-limitations
The current metrics available via scraping from GitHub are:
- [x] Repository count
- [x] Repository contributor count
- [x] Repository branch count
- [x] Repository branch time
- [x] Repository branch commit aheadby count
- [x] Repository branch commit behindby count
- [x] Repository branch line addition count
- [x] Repository branch line deletion count
- [x] Repository pull request open time
- [x] Repository pull request time to merge
- [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
> because this metric relies on the REST API which is subject to lower rate limits.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ func (ghs *githubScraper) getBranches(
var branches []BranchNode

for next := true; next; {
// We decided to not use the defaultReturnItems here because the number
// we've the GitHub GraphQL internal server kill the connection on
// larger queries for branch data around the 80 per page mark.
r, err := getBranchData(ctx, client, repoName, ghs.cfg.GitHubOrg, 50, defaultBranch, cursor)
// Instead of using the defaultReturnItems (100) we chose to set it to
// 50 because GitHub has been known to kill the connection server side
// when trying to get items over 80 on the getBranchData query.
items := 50
r, err := getBranchData(ctx, client, repoName, ghs.cfg.GitHubOrg, items, defaultBranch, cursor)
if err != nil {
ghs.logger.Sugar().Errorf("error getting branch data", zap.Error(err))
return nil, 0, err
Expand Down

0 comments on commit f0370b5

Please sign in to comment.