【发布时间】:2021-11-06 07:27:04
【问题描述】:
我正在尝试使用云功能以编程方式创建基于日志的指标。我真的没有找到任何代码示例,所以我有点迷茫。这是我到目前为止的代码
from google.cloud import logging_v2
metric = {"name":"test","filter":"stuff_here"}
client = logging_v2.Client()
client.create(metric)
我有以下错误module 'google.cloud.logging_v2' has no attribute 'Client'
#编辑
我在文档中找到了一些代码示例:
metric = client.metric(metric_name, filter_=filter, description=description)
assert not metric.exists() # API call
metric.create() # API call
assert metric.exists() # API call
但仍然遇到同样的错误
【问题讨论】:
标签: python google-cloud-platform google-cloud-functions google-cloud-logging