This PR adds the option to pass in a MonitoredResource object when creating an exporter instance, which is then used for all export calls. If not passed, it will fallback to the current behavior of parsing a resource out of the Otel Resource object
The main intention is to allow users to pass in additional monitored_resource types, but it also has performance benefits, using a cached object instead of re-constructing it from scratch for each metric.
It may also make sense to make changes to gcp_resource_detector.get_monitored_resource to parse arbitrary monitored resource types out of the Otel Resource, but I left that off for now for simplicity.
This PR adds the option to pass in a MonitoredResource object when creating an exporter instance, which is then used for all export calls. If not passed, it will fallback to the current behavior of parsing a resource out of the Otel Resource object
The main intention is to allow users to pass in additional monitored_resource types, but it also has performance benefits, using a cached object instead of re-constructing it from scratch for each metric.
It may also make sense to make changes to gcp_resource_detector.get_monitored_resource to parse arbitrary monitored resource types out of the Otel Resource, but I left that off for now for simplicity.
If this change seems reasonable, I can add tests
Fixes https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/issues/298