OpenCensus stats problem with Cloud monitoring on GCP
I'm testing using opencensus to send metrics to stackdriver on GCP. I followed the example of this link and used the same code: https://cloud.google.com/monitoring/custom-metrics/open-census. I test it locally (not on GCE or any other GCP services). Somehow the metrics or data is not in stackdriver, however I can find the view I created in the Metric Explorer in Cloud Monitoring UI.
Describe your environment. My local setup is Python 3.8.3, the requirements is exactly the same as in the docu:
grpcio==1.38.0
opencensus-ext-stackdriver==0.7.4
opencensus==0.7.13
Steps to reproduce. No changes on the code, just run it locally, not on GCE or others.
What is the expected behavior? See the data/view in the metrics explorer
What is the actual behavior? I can find the view metrics explorer, but no data in there.
Additional context.
Just for curiosity I use the same code and run it on GCE, it works! My questions is how could that happen? Is there anything I missed regarding setup or account?
Locally I first tried with my personal account with right permissions and cloud apis enabled, then switched a service account, for both the same thing happens that I can find the view I created, but no data.
Hope you can help me further. Thank you!
Best Xibin