Skip to content

Commit

Permalink
[receiver/gitproviderreceiver] rename to githubreceiver (open-telemet…
Browse files Browse the repository at this point in the history
…ry#34731)

**Description:** <Describe what has changed.>
Renames `gitproviderreceiver` to `githubreceiver` to better align with
OpenTelemetry Semantic Conventions v1.27.0+ and allow for tracing and
log signals in the future.

---------

Co-authored-by: Andrzej Stencel <[email protected]>
Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
3 people authored and f7o committed Sep 12, 2024
1 parent cd766d3 commit 419c3f3
Show file tree
Hide file tree
Showing 50 changed files with 141 additions and 113 deletions.
30 changes: 30 additions & 0 deletions .chloggen/gitprovider-rename.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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: The Git Provider Receiver has been renamed to GitHub Receiver.

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

# (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: |
This rename was to better match the OpenTelemetry semantic convention changes in v1.27.0
and allows for Traces and Log signals to be added to this component. Traces
as mentioned in issue #27460 will be added in a future release to this component.
# 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: []
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ receiver/filelogreceiver/ @open-teleme
receiver/filestatsreceiver/ @open-telemetry/collector-contrib-approvers @atoulme
receiver/flinkmetricsreceiver/ @open-telemetry/collector-contrib-approvers @JonathanWamsley @djaglowski
receiver/fluentforwardreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax
receiver/gitproviderreceiver/ @open-telemetry/collector-contrib-approvers @adrielp @andrzej-stencel @crobert-1
receiver/githubreceiver/ @open-telemetry/collector-contrib-approvers @adrielp @andrzej-stencel @crobert-1
receiver/googlecloudmonitoringreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @TylerHelmuth @abhishek-at-cloudwerx
receiver/googlecloudpubsubreceiver/ @open-telemetry/collector-contrib-approvers @alexvanboxel
receiver/haproxyreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @MovieStoreGuy
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ body:
- receiver/filestats
- receiver/flinkmetrics
- receiver/fluentforward
- receiver/gitprovider
- receiver/github
- receiver/googlecloudmonitoring
- receiver/googlecloudpubsub
- receiver/googlecloudspanner
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ body:
- receiver/filestats
- receiver/flinkmetrics
- receiver/fluentforward
- receiver/gitprovider
- receiver/github
- receiver/googlecloudmonitoring
- receiver/googlecloudpubsub
- receiver/googlecloudspanner
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ body:
- receiver/filestats
- receiver/flinkmetrics
- receiver/fluentforward
- receiver/gitprovider
- receiver/github
- receiver/googlecloudmonitoring
- receiver/googlecloudpubsub
- receiver/googlecloudspanner
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ body:
- receiver/filestats
- receiver/flinkmetrics
- receiver/fluentforward
- receiver/gitprovider
- receiver/github
- receiver/googlecloudmonitoring
- receiver/googlecloudpubsub
- receiver/googlecloudspanner
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# Git Provider Receiver
# GitHub Receiver

<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [development]: metrics |
| Distributions | [] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fgitprovider%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fgitprovider) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fgitprovider%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fgitprovider) |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fgithub%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fgithub) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fgithub%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fgithub) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@adrielp](https://www.github.com/adrielp), [@andrzej-stencel](https://www.github.com/andrzej-stencel), [@crobert-1](https://www.github.com/crobert-1) |

[development]: https://github.com/open-telemetry/opentelemetry-collector#development
<!-- end autogenerated section -->

The Git Provider receiver scrapes data from Version Control Systems (VCS) that use Git as their underlying technology.
The GitHub receiver receives data from [GitHub](https://github.com). As a
starting point it scrapes metrics from repositories but will be extended to
include traces and logs.

As a starting point, this receiver can infer many of the same core VCS metrics across vendors, while being able to receive additional data specific to vendors.
The current default set of metrics can be found in
[documentation.md](./documentation.md).

The current default set of metrics common across all vendors can be found in [documentation.md](./documentation.md).

These VCS metrics can be used as leading indicators ([capabilities][doracap]) to the [DORA][dorafour] metrics; helping provide insight into modern-day engineering practices.
These metrics can be used as leading indicators ([capabilities][doracap])
to the [DORA][dorafour] metrics; helping provide insight into modern-day
engineering practices.

[doracap]: https://dora.dev/capabilities/
[dorafour]: https://dora.dev/guides/dora-metrics-four-keys/
Expand All @@ -31,7 +34,7 @@ The collection interval is common to all scrapers and is set to 30 seconds by de
> and organizations. You may run into significantly more rate limiting.
```yaml
gitprovider:
github:
collection_interval: <duration> #default = 30s recommended 300s
scrapers:
<scraper1>:
Expand All @@ -47,7 +50,7 @@ extensions:
token: ${env:GH_PAT}

receivers:
gitprovider:
github:
initial_delay: 1s
collection_interval: 60s
scrapers:
Expand All @@ -64,23 +67,16 @@ service:
extensions: [bearertokenauth/github]
pipelines:
metrics:
receivers: [..., gitprovider]
receivers: [..., github]
processors: []
exporters: [...]
```
This receiver is developed upstream in the [liatrio-otel-collector distribution](https://github.com/liatrio/liatrio-otel-collector)
where a quick start exists with an [example config](https://github.com/liatrio/liatrio-otel-collector/blob/main/config/config.yaml)
A Grafana Dashboard exists on the marketplace for this receiver and can be
found [here](https://grafana.com/grafana/dashboards/20976-engineering-effectiveness-metrics/).
A Grafana Dashboard exists on the marketplace for metrics from this receiver
and can be found
[here](https://grafana.com/grafana/dashboards/20976-engineering-effectiveness-metrics/).
The available scrapers are:
| Scraper | Description |
|----------|-------------------------|
| [github] | VCS Metrics from [GitHub](https://github.com/) |
## GitHub Scraper
## Scraping
> Important:
> * The GitHub scraper does not emit metrics for branches that have not had
Expand All @@ -89,7 +85,9 @@ The available scrapers are:
> change when rebases occur, recreating the commits with new timestamps.
<!-- TODO: Combine this documentation once the scraper code is restructured due scope change -->
For additional context on GitHub scraper limitations and inner workings please
see the [GitHub Scraper README][ghsread].
see the [Scraping README][ghsread].
[ghsread]: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/gitproviderreceiver/internal/scraper/githubscraper/README.md#github-limitations
[ghsread]: internal/scraper/githubscraper/README.md#github-limitations
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package gitproviderreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver"
package githubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver"

import (
"errors"
Expand All @@ -11,8 +11,8 @@ import (
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/receiver/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/metadata"
)

const (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package gitproviderreceiver
package githubreceiver

import (
"path/filepath"
Expand All @@ -15,9 +15,9 @@ import (
"go.opentelemetry.io/collector/otelcol/otelcoltest"
"go.opentelemetry.io/collector/receiver/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal/scraper/githubscraper"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/scraper/githubscraper"
)

func TestLoadConfig(t *testing.T) {
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestLoadInvalidConfig_InvalidScraperKey(t *testing.T) {
// nolint:staticcheck
_, err = otelcoltest.LoadConfigAndValidate(filepath.Join("testdata", "config-invalidscraperkey.yaml"), factories)

require.Contains(t, err.Error(), "error reading configuration for \"gitprovider\": invalid scraper key: \"invalidscraperkey\"")
require.Contains(t, err.Error(), "error reading configuration for \"github\": invalid scraper key: \"invalidscraperkey\"")
}

func TestConfig_Unmarshal(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions receiver/githubreceiver/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:generate mdatagen metadata.yaml

package githubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)

# gitprovider
# github

## Default Metrics

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package gitproviderreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver"
package githubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver"

import (
"context"
Expand All @@ -13,22 +13,22 @@ import (
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal/scraper/githubscraper"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/scraper/githubscraper"
)

// This file implements a factory for the git provider receiver
// This file implements a factory for the github receiver

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

errConfigNotValid = errors.New("configuration is not valid for the git provider receiver")
errConfigNotValid = errors.New("configuration is not valid for the github receiver")
)

// NewFactory creates a factory for the git provider receiver
// NewFactory creates a factory for the github receiver
func NewFactory() receiver.Factory {
return receiver.NewFactory(
metadata.Type,
Expand All @@ -52,7 +52,7 @@ func createDefaultConfig() component.Config {
ControllerConfig: scraperhelper.NewDefaultControllerConfig(),
// TODO: metrics builder configuration may need to be in each sub scraper,
// TODO: for right now setting here because the metrics in this receiver will apply to all
// TODO: scrapers defined as a common set of gitprovider
// TODO: scrapers defined as a common set of github
// TODO: aqp completely remove these comments if the metrics build config
// needs to be defined in each scraper
// MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
Expand Down Expand Up @@ -96,19 +96,19 @@ func createAddScraperOpts(
scraperControllerOptions := make([]scraperhelper.ScraperControllerOption, 0, len(cfg.Scrapers))

for key, cfg := range cfg.Scrapers {
gitProviderScraper, err := createGitProviderScraper(ctx, params, key, cfg, factories)
githubScraper, err := createGitHubScraper(ctx, params, key, cfg, factories)

if err != nil {
return nil, fmt.Errorf("failed to create scraper %q: %w", key, err)
}

scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraper(gitProviderScraper))
scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraper(githubScraper))
}

return scraperControllerOptions, nil
}

func createGitProviderScraper(
func createGitHubScraper(
ctx context.Context,
params receiver.Settings,
key string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package gitproviderreceiver
package githubreceiver

import (
"context"
Expand All @@ -14,7 +14,7 @@ import (
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal"
)

var creationSet = receivertest.NewNopSettings()
Expand Down

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.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver

go 1.22.0

Expand Down Expand Up @@ -95,9 +95,9 @@ require (
go.opentelemetry.io/collector/processor v0.108.1 // indirect
go.opentelemetry.io/collector/service v0.108.1 // indirect
go.opentelemetry.io/contrib/config v0.8.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
Expand All @@ -108,11 +108,11 @@ require (
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 // indirect
go.opentelemetry.io/otel/log v0.4.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/log v0.4.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
Expand All @@ -121,7 +121,7 @@ require (
golang.org/x/text v0.17.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 419c3f3

Please sign in to comment.