1

Im using this lib for a while, everything was working great. Using it to query cpu utilization of gcloud machines.

this is my code:

query_obj = Query(metric_service_client, project, "compute.googleapis.com/instance/cpu/utilization", 
minutes=mins_backward_check)
metric_res = query_obj.as_dataframe()

Everything was working fine until lately it started to fail.

I'm getting:

{AttributeError}'WhichOneof'

Deubbing it, i see it fails inside "as_dataframe()" code, specifically in this part:

data=[_extract_value(point.value) for point in time_series.points]

When it tries to extract the value from the point object. The _extract_value values code seems to use the WhichOneof attribute which seems to be related to protobuff lib.

I didn't change any of those libs versions, anyone has any clue what causes it to fail now?

tamirg
  • 607
  • 1
  • 7
  • 15
  • Hello, Are you still having problems ? Could you please post your requirements.txt to try to replicate your case – vi calderon Feb 26 '21 at 18:33

1 Answers1

1

If you're confident (!) that you've not changed anything, then this would appear to be Google breaking its API and you may wish to file an issue on Google's issue tracker on one of these components:

I think Cloud Monitoring is natively a gRPC-based API which would explain the protobuf reference.

A good sanity check is to use APIs Explorer and check the method you're using there to see whether you can account for the request|response, perhaps:

https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/query

NOTE Your question may be easy to parse for someone familiar with the Cloud Monitoring Python SDK but isn't easy to repro. Please consider providing a simple repro of your issue, including requirements.txt and a full code snippet.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88