Skip to content

Commit

Permalink
Remove unneeded Auth Extension files (#842)
Browse files Browse the repository at this point in the history
* Remove unneeded Auth Extension files

* feedback
  • Loading branch information
damemi authored Apr 30, 2024
1 parent 43f7095 commit bda7f02
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 124 deletions.
10 changes: 0 additions & 10 deletions extension/googleclientauthextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,3 @@ Following are the configuration fields:
- **project** - The Google Cloud Project telemetry is sent to if the gcp.project.id resource attribute is not set. If unspecified, this is determined using application default credentials.
- [**scopes**](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3) - The oauth 2.0 scopes requested by the extension.
- [**quota_project**](https://cloud.google.com/apis/docs/system-parameters) - The project for quota and billing purposes. The caller must have serviceusage.services.use permission on the project.
## Building into a Collector
This extension is not included in any collector distributions today. To build a collector with this component, add the following to your collector builder configuration:
```yaml
extensions:
- import: github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension
gomod: github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.43.0
```
57 changes: 0 additions & 57 deletions extension/googleclientauthextension/config_test.go

This file was deleted.

12 changes: 0 additions & 12 deletions extension/googleclientauthextension/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,8 @@ import (
"go.opentelemetry.io/collector/extension"
"golang.org/x/oauth2/google"
"google.golang.org/grpc/credentials/oauth"

"github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension/internal/metadata"
)

// NewFactory creates a factory for the GCP Auth extension.
func NewFactory() extension.Factory {
return extension.NewFactory(
metadata.Type,
CreateDefaultConfig,
CreateExtension,
metadata.ExtensionStability,
)
}

func CreateExtension(ctx context.Context, set extension.CreateSettings, cfg component.Config) (extension.Extension, error) {
config := cfg.(*Config)
ca := &clientAuthenticator{
Expand Down
14 changes: 4 additions & 10 deletions extension/googleclientauthextension/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@ import (
)

func TestCreateDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
cfg := CreateDefaultConfig()
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
}

func TestNewFactory(t *testing.T) {
f := NewFactory()
assert.NotNil(t, f)
}

func TestCreateExtension(t *testing.T) {
t.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "testdata/fake_creds.json")
ext, err := NewFactory().CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
ext, err := CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
assert.NotNil(t, ext)
assert.NoError(t, err)
}

func TestStart(t *testing.T) {
t.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "testdata/fake_creds.json")
ext, err := NewFactory().CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
ext, err := CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
assert.NotNil(t, ext)
assert.NoError(t, err)
err = ext.Start(context.Background(), nil)
Expand All @@ -53,7 +47,7 @@ func TestStart(t *testing.T) {

func TestStart_WithError(t *testing.T) {
t.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "testdata/foo.json")
ext, err := NewFactory().CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
ext, err := CreateExtension(context.Background(), extension.CreateSettings{}, CreateDefaultConfig())
assert.NotNil(t, ext)
assert.NoError(t, err)
err = ext.Start(context.Background(), nil)
Expand Down
2 changes: 1 addition & 1 deletion extension/googleclientauthextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.21
require (
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/component v0.99.0
go.opentelemetry.io/collector/confmap v0.99.0
go.opentelemetry.io/collector/extension v0.94.0
golang.org/x/oauth2 v0.18.0
google.golang.org/grpc v1.63.2
Expand Down Expand Up @@ -33,6 +32,7 @@ require (
github.com/prometheus/common v0.52.3 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.99.0 // indirect
go.opentelemetry.io/collector/confmap v0.99.0 // indirect
go.opentelemetry.io/collector/pdata v1.6.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.47.0 // indirect
Expand Down
27 changes: 0 additions & 27 deletions extension/googleclientauthextension/internal/metadata/status.go

This file was deleted.

7 changes: 0 additions & 7 deletions extension/googleclientauthextension/testdata/config.yaml

This file was deleted.

0 comments on commit bda7f02

Please sign in to comment.