python - Google Cloud:自定义堆栈驱动程序指标
问题描述
我正在运行一个自定义 Python 应用程序。代码中的日志记录被写入 Stackdriverm,很好。但是对于特定的代码块,我正在考虑在 Stackdriver 中创建自定义指标。但这是我的问题。有一些官方文档:
他们都使用这样开头的代码:
from google.cloud import monitoring
client = monitoring.Client()
descriptor = client.metric_descriptor(
'custom.googleapis.com/my_metric',
metric_kind=monitoring.MetricKind.GAUGE,
value_type=monitoring.ValueType.DOUBLE,
description='This is a simple example of a custom metric.')
我的问题是,我无法重现此代码。我已经安装了以下库:
但是当我尝试代码时,它说包中Client
没有google-cloud-monitoring
。相反,有一个MetricServiceClient
,但我找不到任何关于如何使用它的好文档。
PS:我的 IDE 是 PyCharm。
和想法?
解决方案
现在,使用客户端库的 0.28.1 版本。我将很快更新官方文档,以便它们可以工作 0.29。
推荐阅读
- spring - 具有多个客户端的 Spring webflux 超时
- excel - 为每个打开的工作簿执行功能
- arrays - 如何读取 Json 中的特定列表
- python - 如何列出模块所依赖的用户创建的 python 文件?
- typescript - 除了 tsc,还有其他 TypeScript 工具吗?
- google-sheets - SUBSTITUTE 错误:“超过 50000 个字符的限制”——当文本字符串只有 4000 个字符时
- java - 检测是否已生成文件并将文件从一个目录移动到另一个目录
- c - 如何从精灵调用和编译函数到我的二进制文件?
- c# - 在 UWP 项目中将文件上传到 WebDAV
- go - 迭代时删除字典键是否安全?