Moved risky logic from FromFlags, see code comment why.
Added regession test.
Regression test fails on prev flow (no context propagation)
Alternatives
Everything we do in FromFlags or constructor is within readines period. We
could consider moving potentially "slow" things on slow network or metadata srv
to exporter.Run. This could be questionable as for GMP to work
we at end need export functionality to work, so delaying that information or
making it surface in separation to readiness might not be helpful.
Fixes b/344740239 (edge case with GKE Metadata Server and GKE sandbox).
Regression test fails on prev flow (no context propagation)
Alternatives
Everything we do in FromFlags or constructor is within readines period. We could consider moving potentially "slow" things on slow network or metadata srv to exporter.Run. This could be questionable as for GMP to work we at end need export functionality to work, so delaying that information or making it surface in separation to readiness might not be helpful.
EDIT: Added PR against metadata so we can get rid of custom code in the future: https://github.com/googleapis/google-cloud-go/pull/10370