问题描述
当您使用 AI-Platform 部署模型时,您可以在链接中看到
https://console.cloud.google.com/apis/api/ml.googleapis.com/metrics?project=<my_project_name>
部署 ML 模型的 API(或特别是端点)的一些性能指标,例如延迟(响应时间)、发生了多少 200 状态代码等...
我想从 python 中获取这些信息,而不是在 GUI 中获取它。这可能吗 ? 我正在阅读文档 here,但似乎找不到答案。
解决方法
您需要在 Python 中安装客户端库。之后,您需要设置身份验证,然后开始使用客户端库。您可以在 Google 文档中找到有关 Python 案例 [1] 的详细指南。
除了按照链接中的步骤操作外,这里还列出了来自 AI Platform [2] 的可用指标。
最后,这里有更多关于 Python Client for Cloud Monitoring API [3] 的信息。
[1] https://cloud.google.com/monitoring/docs/reference/libraries#client-libraries-install-python
[2] https://cloud.google.com/monitoring/api/metrics_gcp#gcp-aiplatform
[3] https://googleapis.dev/python/monitoring/latest/index.html