如何从google.cloud.monitoring_v3传递参数到list_time_series方法?


for iteration in range(2160):  # iterate back in time over 90 days
results = client.list_time_series(
name,
'metric.type = "appengine.googleapis.com/http/server/response_count"',
interval,
monitoring_v3.ListTimeSeriesRequest.TimeSeriesView.FULL)

当我执行代码时,它抛出一个错误,

File "d:internGCPapp_engine.py", line 44, in collect_metric_data
results = client.list_time_series(
TypeError: list_time_series() takes from 1 to 2 positional arguments but 5 were given

但是list_time_series方法可以接受多于2个参数。

def list_time_series(request: metric_service.ListTimeSeriesRequest=None, name: str=None, filter: str=None, interval: common.TimeInterval=None, view: metric_service.ListTimeSeriesRequest.TimeSeriesView=None, retry: retries.Retry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[str, str]]=())

我找不到哪里出错了。帮我解决这个问题。

位置参数未被正确识别。您可以手动定义它们以便识别它们。有关传递哪些值的更多细节,请参阅list_time_series参考。

results = client.list_time_series(
name=name, #value must be projects/[PROJECT_ID_OR_NUMBER]
filter='metric.type = "appengine.googleapis.com/http/server/response_count"',
interval=interval,
view=monitoring_v3.ListTimeSeriesRequest.TimeSeriesView.FULL)

相关内容

  • 没有找到相关文章

最新更新