Skip to content

Commit

Permalink
remove otel injection as the libraries does it for us
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Feb 12, 2024
1 parent 09975ce commit 59a743c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions internal/google_token_source/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import (
"context"
"fmt"

"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"golang.org/x/oauth2"
admin_directory "google.golang.org/api/admin/directory/v1"
"google.golang.org/api/cloudresourcemanager/v3"
"google.golang.org/api/impersonate"
"google.golang.org/api/option"
)

type Builder struct {
Expand Down Expand Up @@ -41,7 +39,7 @@ func (g Builder) impersonateTokenSource(ctx context.Context, delegate bool, scop
impersonateConfig.Subject = g.subjectEmail
}

return impersonate.CredentialsTokenSource(ctx, impersonateConfig, option.WithHTTPClient(otelhttp.DefaultClient))
return impersonate.CredentialsTokenSource(ctx, impersonateConfig)
}

func (g Builder) Admin(ctx context.Context) (oauth2.TokenSource, error) {
Expand Down
3 changes: 1 addition & 2 deletions internal/reconcilers/google/gar/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/nais/api/pkg/protoapi"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/iam/v1"
"google.golang.org/api/option"
Expand Down Expand Up @@ -80,7 +79,7 @@ func New(ctx context.Context, googleManagementProjectID, tenantDomain, workloadI
}

if r.iamService == nil {
iamService, err := iam.NewService(ctx, option.WithTokenSource(ts), option.WithHTTPClient(otelhttp.DefaultClient))
iamService, err := iam.NewService(ctx, option.WithTokenSource(ts))
if err != nil {
return nil, err
}
Expand Down
2 changes: 0 additions & 2 deletions internal/reconcilers/google/gcp/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/nais/api/pkg/apiclient/iterator"
"github.com/nais/api/pkg/protoapi"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"google.golang.org/api/cloudbilling/v1"
"google.golang.org/api/cloudresourcemanager/v3"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -555,7 +554,6 @@ func createGcpServices(ctx context.Context, googleManagementProjectID, tenantDom

opts := []option.ClientOption{
option.WithTokenSource(ts),
option.WithHTTPClient(otelhttp.DefaultClient),
}

cloudResourceManagerService, err := cloudresourcemanager.NewService(ctx, opts...)
Expand Down
3 changes: 1 addition & 2 deletions internal/reconcilers/google/workspace_admin/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/nais/api/pkg/apiclient"
"github.com/nais/api/pkg/protoapi"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
admin_directory_v1 "google.golang.org/api/admin/directory/v1"
"google.golang.org/api/googleapi"
"google.golang.org/api/option"
Expand Down Expand Up @@ -62,7 +61,7 @@ func New(ctx context.Context, googleManagementProjectID, tenantDomain string, op
return nil, fmt.Errorf("get delegated token source: %w", err)
}

srv, err := admin_directory_v1.NewService(ctx, option.WithTokenSource(ts), option.WithHTTPClient(otelhttp.DefaultClient))
srv, err := admin_directory_v1.NewService(ctx, option.WithTokenSource(ts))
if err != nil {
return nil, fmt.Errorf("retrieve directory client: %w", err)
}
Expand Down

0 comments on commit 59a743c

Please sign in to comment.