Stackdriver 基于日志的指标不显示日志记录报告的值

Stackdriver log-based metrics does not display the values as reported by logging

我的目标是直接根据日志值建立指标。问题是当我将它们显示为图形时,它们看起来像是分布的。我如何更改它以显示日志中的值?

不幸的是,Stackdriver 无法以这种方式工作,您不应期望 Stackdriver 在这种情况下会向您显示“52”。看看官方 documentation 其中 "logs-based metrics can be one of two metric types: counter or distribution" 和 "counter metrics count the number of log entries matching" 和 "distribution metrics is to track latencies"。您必须为此任务选择其他工具。

假设您将其创建为分布指标,我希望它能起作用。请查看此博客 post 以确保您正确使用对准器和聚合器。