opencensus-cpp
opencensus-cpp copied to clipboard
Stackdriver exporters: automatically determine project_id
When running on GCE, this should be doable via the metadata server: https://cloud.google.com/compute/docs/storing-retrieving-metadata#default
/subscribe
sample implementation in a test program here. Uses cpr as an idiomatic wrapper to libcurl.
- needs to be encapsulated, moved to a library ( in
opencensus/common/internal/cloud
? ). Unless a dedicated, idiomatic library is provided by google-cloud-cpp. - needs to make the distinction between GCE VM, GKE container/pod, ( a docker container inside GCE VM? inside AppEngine flex ? inside Cloud Run ? they will have different well known
google.api.MonitoredResource
objects and labels...) - a lingering question remains in my mind on the difference between the project id at the monitored resource level and as a monitored resource label (lines 210-213) . Are they the same when on GCE VM? if a workspace monitors multiple project, does the code submitting the metric need to know a 'stackdriver project id ?'