prometheus-community / prometheus-community/stackdriver_exporter

Does not respect GOOGLE_CLOUD_QUOTA_PROJECT env variable

Open
#432 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
295
Forks
117
Avg merge
9d 14h
Merged PRs (30d)
7

Description

The monitoring.Service is constructed with a http.Client based on google.DefaultClient from golang.org/x/oauth2/google.

It seems this does not respect the environment variable GOOGLE_CLOUD_QUOTA_PROJECT to set the X-goog-user-project request header (GCP docs). The use of WithHTTPClient takes precedence and so the code that would otherwise set up the client in a way that respected the quota project is not used.

I can't see a straightforward way to fix this without specifically adding something into stackdriver_exporter to configure the quota project – but I'm not an expert in Go or the GCP client libraries.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the monitoring.Service construction and trace how google.DefaultClient and WithHTTPClient determine the request transport. Compare that path with the google-api-go-client transport behavior linked in the issue, then verify that GOOGLE_CLOUD_QUOTA_PROJECT results in the expected X-goog-user-project header and add coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, google-cloud
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.