堆栈驱动程序指标导出
Stack-driver metrics export
环境:云壳
代码:python2.7
我想将指标从 Cloud Monitoring 导出到 Big Query,google 已经给出了如何执行此操作的解决方案。我在下面这篇文章中关注这个:
https://cloud.google.com/solutions/stackdriver-monitoring-metric-export
我已经从 github 下载了代码:https://github.com/GoogleCloudPlatform/stackdriver-metrics-export
我正在按照自述文件并尝试 运行 我的 google 项目中的应用程序。
当我安装 运行 任何应用引擎时
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
。在 App Engine 控制台中,应用程序 运行ning 在服务选项卡中
另一个问题是,如果我在创建主题后尝试从源代码中提到的 cloudshell 创建 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
有没有人以前尝试过使用此代码?我对 google 云和 python 完全陌生。
请帮助
从 LIST_METRICS_URL 中捕获的 App Engine URL 中删除 region_id 和“r”将允许您创建 Pub/Sub 订阅。
github 存储库 README.md 已更新,以反映在 here.
中记录的 App Engine 中 region_id 处理的变化
例如,LIST_METRICS_URL 是
# if this is your first app in your project
export LIST_METRICS_URL=https://$PROJECT_ID.appspot.com
或
# if this is not your first app in your project
export LIST_METRICS_URL=https://list-metrics-dot-$PROJECT_ID.appspot.com
环境:云壳 代码:python2.7
我想将指标从 Cloud Monitoring 导出到 Big Query,google 已经给出了如何执行此操作的解决方案。我在下面这篇文章中关注这个: https://cloud.google.com/solutions/stackdriver-monitoring-metric-export
我已经从 github 下载了代码:https://github.com/GoogleCloudPlatform/stackdriver-metrics-export
我正在按照自述文件并尝试 运行 我的 google 项目中的应用程序。
当我安装 运行 任何应用引擎时
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
。在 App Engine 控制台中,应用程序 运行ning 在服务选项卡中
另一个问题是,如果我在创建主题后尝试从源代码中提到的 cloudshell 创建 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
有没有人以前尝试过使用此代码?我对 google 云和 python 完全陌生。 请帮助
从 LIST_METRICS_URL 中捕获的 App Engine URL 中删除 region_id 和“r”将允许您创建 Pub/Sub 订阅。
github 存储库 README.md 已更新,以反映在 here.
中记录的 App Engine 中 region_id 处理的变化例如,LIST_METRICS_URL 是
# if this is your first app in your project
export LIST_METRICS_URL=https://$PROJECT_ID.appspot.com
或
# if this is not your first app in your project
export LIST_METRICS_URL=https://list-metrics-dot-$PROJECT_ID.appspot.com