Tuesday, 14 September 2021

print list metric with list_metrics() from cloud logging api (generator Expression 0x3e9bfe2fb4c0>)

I want to log all the log-based metrics I have in my gcp project with a cloud function in python. I'm trying to run the following code sample:

for metric in client.list_metrics():  # API call(s)
    #do_something_with(metric)
    print(metric)

I have the following log output:

"<google.cloud.logging_v2.metric.Metric object at 0x3e9bfe2fb4c0>"

How do I read this? I tried list(), json.loads(), json.dumps() but nothing seems to work.



from print list metric with list_metrics() from cloud logging api (generator Expression 0x3e9bfe2fb4c0>)

No comments:

Post a Comment