Repository navigation
Relax the requirement for stackdriver project id for metrics exporter. - #147
Conversation
|
/assign @mattmoor @mdemirhan |
| if !ok || sdProj == "" { | ||
| return nil, errors.New("For backend stackdriver, metrics.stackdriver-project-id field must exist and cannot be empty") | ||
| if ok && sdProj != "" { | ||
| mc.stackdriverProjectID = sdProj |
There was a problem hiding this comment.
When this is left empty, do OpenCensus pick the current GKE project as the SD project id?
There was a problem hiding this comment.
The question is my mind is: how discoverable would that be for users?
Noting that metadata.ProjectID() returns an optional error (e.g. not running on GCE), I would contend that we should explicitly use it here and surface the error (rejecting the configmap update).
There was a problem hiding this comment.
@mdemirhan yes, OpenCensus is able to use the current GCP project as the SD project ID in my testing.
@mattmoor If OpenCensus is not able to use the default account, it'll return an error when creating a metrics exporter:
errors.New("stackdriver: no project found with application default credentials")"
Is this sufficient?
There was a problem hiding this comment.
Maybe add a comment for what will happen in case stackdriverProjectIDKey is not provided and OpenCensus is not able to use the default account.
|
Gentle ping. Could you please take a look when you get a chance? After this pr is in, I can update knative/serving#2337. |
| sdProj, ok := m[stackdriverProjectIDKey] | ||
| if !ok || sdProj == "" { | ||
| return nil, errors.New("For backend stackdriver, metrics.stackdriver-project-id field must exist and cannot be empty") | ||
| if ok && sdProj != "" { |
There was a problem hiding this comment.
We could simply do:
mc.stackdriverProjectID = m[stackdriverProjectIDKey]
If the project doesnt exist, map will return "" anyway.
|
The following is the coverage report on pkg/.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: akyyy, mdemirhan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When metrics.stackdriver-project-id is not provided and the deployment is in GKE, there is application default credentials for the stackdriver exporter.
This is to address @mattmoor 's comment in knative/serving#2337