Use experimental metrics api
As I wanted to enable both tracing and monitoring in one project, I modified the code to use the experimental metrics api.
Keep in mind that I made the following assumptions:
- keep the start and end times of the exported metrics as is
- bounds and values of histogram are of equal length
Moreover I added locking when accessing the metric descriptors (otherwise test_cloud_monitoring_exporter_integration.py would fail randomly).
I introduced metrictestutil.py with convenience functions to create metrics (based on https://github.com/open-telemetry/opentelemetry-python/blob/main/tests/opentelemetry-test-utils/src/opentelemetry/test/metrictestutil.py)
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
For more information, open the CLA check for this pull request.
Thanks for taking a stab at this. I've opened a separate PR https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/204 and decided to gut some of the code and tests as so much of it is no longer applicable.