Skip to content

Commit

Permalink
Fix lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanedey committed Nov 19, 2024
1 parent 084440c commit c04763b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions auth/token_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ type iamSigner struct {

func newIAMSigner(ctx context.Context, config *internal.AuthConfig) (*iamSigner, error) {
hc, _, err := internal.NewHTTPClient(ctx, config.Opts...)
hc.Opts = []internal.HTTPOption{
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(config.Version)),
}
if err != nil {
return nil, err
}
hc.Opts = []internal.HTTPOption{
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(config.Version)),
}

return &iamSigner{
mutex: &sync.Mutex{},
Expand Down
6 changes: 3 additions & 3 deletions iid/iid.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ func NewClient(ctx context.Context, c *internal.InstanceIDConfig) (*Client, erro
}

hc, _, err := internal.NewHTTPClient(ctx, c.Opts...)
hc.Opts = []internal.HTTPOption{
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(c.Version)),
}
if err != nil {
return nil, err
}
hc.Opts = []internal.HTTPOption{
internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(c.Version)),
}

hc.CreateErrFn = createError
return &Client{
Expand Down
1 change: 1 addition & 0 deletions internal/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ func retryNetworkAndHTTPErrors(statusCodes ...int) RetryCondition {
}
}

// GetMetricsHeader constructs header value for metrics attribution
func GetMetricsHeader(sdkVersion string) string {
goVersion := strings.TrimPrefix(runtime.Version(), "go")
return fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, sdkVersion)
Expand Down

0 comments on commit c04763b

Please sign in to comment.