环境:CloudShell 代码:python2.7
我想将 Metrics 从 Cloud Monitoring 导出到 Big Query,谷歌已经给出了如何做到这一点的解决方案。我在下面的这篇文章中关注这一点: https ://cloud.google.com/solutions/stackdriver-monitoring-metric-export
我已经从 github 下载了代码:https://github.com/GoogleCloudPlatform/stackdriver-metrics-export并且我正在遵循自述文件并尝试在我的 google 项目中运行该应用程序。
当我安装并运行任何应用程序引擎 ex
https://get-timeseries-dot-managed-gcp.uc.r.appspot.com// 时,我总是收到此错误 500:
错误:服务器错误
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
在我检查的日志中,我得到了他的
0: {
logMessage: "Traceback (most recent call last):
File "/base/data/home/apps/s~myproject/get-timeseries:20200623t152416.427592472816201321/main.py", line 23, in <module>
from googleapiclient.discovery import build
ImportError: No module named googleapiclient.discovery"
severity: "ERROR"
sourceLocation: {
file: "/base/alloc/tmpfs/dynamic_runtimes/python27g/534e28e62871e9ae/python27/python27_lib/versions/1/google/appengine/runtime/cgi.py"
functionName: "HandleRequest"
line: "123"
}
time: "2020-06-23T10:04:42.365030Z"
}
1: {
logMessage: "This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application."
severity: "INFO"
time: "2020-06-23T10:04:42.368883Z"
}
2: {
logMessage: "The warmup request failed. Please check your warmup handler implementation and make sure it's working correctly."
severity: "INFO"
time: "2020-06-23T10:04:42.368884Z"
}
3: {
logMessage: "Process terminated because it failed to respond to the start request with an HTTP status code of 200-299 or 404."
severity: "ERROR"
time: "2020-06-23T10:04:42.368885Z"
}
]
megaCycles: "241"
method: "GET"
moduleId: "get-timeseries"
requestId: "5ef1d3b500ff0ef7c1e4b283290001737e6d616e616765642d67637000016765742d74696d657365726965733a323032303036323374313532343136000100"
resource: "/_ah/start"
startTime: "2020-06-23T10:04:37.980929Z"
status: 500
traceId: "cc847beddcfade8728ae864d45761acd"
traceSampled: true
urlMapEntry: "main.py"
versionId: "20200623t152416"
wasLoadingRequest: true
. 在应用引擎控制台中,应用程序正在服务选项卡中运行
另一个问题是,如果我在创建主题后尝试从源代码中提到的 cloudshellas 创建 pub-sub 订阅,如下所示:
gcloud pubsub subscriptions create metrics_export_start_sub --topic metrics_export_start --ack-deadline=60 --message-retention-duration=10m --push-endpoint="$LIST_METRICS_URL/_ah/push-handlers/receive_message"
即使我还提供了项目 ID,我也会收到此错误:
The supplied app engine url project does not match the subscription's parent project
由于上述错误,我无法完成 pubsub 订阅。我也搜索并运行了这个
sudo pip install --upgrade google-api-python-client
我正在使用 python 2.7 版本,在安装上述之后我仍然得到
No module named googleapiclient.discovery
以前有人尝试过使用此代码吗?我对谷歌云和python都是全新的。请帮助