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.