I am trying to get data from a custom Stackdriver metric using the Google-Cloud Python library, but beyond returning it as a pandas dataframe I can't get the values I need.
For example the query, which looks something like:
query = client.query(metric_type, minutes=5)
which when using pandas returns something like this:
resource_type l7_lb_rule
project_id my_id
backend_name
backend_zone
forwarding_rule_name foo-http foo-https
instance_group_name
matched_url_path_rule
target_proxy_name foo-target-1 foo-https-060417
target_proxy_type
url_map_name foo foo
log requests requests
2017-06-26 15:43:06.750 26 25
Yet I'm not sure how to manipulate this to get the values I need, which essentially are the number of http and https requests (I want to sum these).
For example if I were to use iterrows()
how could I filter this down so it shows me the data I need?
Or perhaps displaying it as a dataframe isn't how I should be doing it, I just can't see how else to get this data using this library.
Thanks in advance
I have decided to avoid using dataframes entirely and just iterate over the timeseries object to extract the values I need.