opencensus-cpp icon indicating copy to clipboard operation
opencensus-cpp copied to clipboard

Stackdriver exporters: automatically determine project_id

Open g-easy opened this issue 5 years ago • 2 comments

When running on GCE, this should be doable via the metadata server: https://cloud.google.com/compute/docs/storing-retrieving-metadata#default

g-easy avatar Jun 03 '19 19:06 g-easy

/subscribe

mandarjog avatar Jul 03 '19 20:07 mandarjog

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 ?'

alichnewsky avatar Jun 20 '20 09:06 alichnewsky