【发布时间】:2019-04-19 11:55:42
【问题描述】:
假设我有 3 个一起工作的应用程序,并使用 pub-sub 为“管理”发送消息。 假设有一个在开始时创建并通过应用程序传递并写入日志的“事务 id”。
我会得到如下日志:
app1 - transactionIdX - started - timestamp01
app1 - transactionIdX - ended - timestamp02
app2 - transactionIdX - started - timestamp03
app1 - transactionIdY - started - timestamp04
app1 - transactionIdY - ended - timestamp05
app2 - transactionIdX - ended - timestamp06
app3 - transactionIdX - started - timestamp07
app2 - transactionIdY - started - timestamp08
app2 - transactionIdY - ended - timestamp09
app3 - transactionIdX - ended - timestamp10
app3 - transactionIdY - started - timestamp11
app3 - transactionIdY - ended - timestamp12
我想要一个公开此类信息的指标:
-
transactionIdX - 在时间 timestamp10
- 在 app1 中 - 需要 (timestamp02-timestamp01) 秒
- 在 app2 中 - 需要 (timestamp06-timestamp03) 秒
- 在 app3 中 - 需要 (timestamp10-timestamp07) 秒
- 总共 - 需要 (timestamp10-timestamp01) 秒
-
transactionIdY - 在时间 timestamp12
- 在 app1 中 - 需要 (timestamp05-timestamp04) 秒
- 在 app2 中 - 需要 (timestamp09-timestamp08) 秒
- 在 app3 中 - 需要 (timestamp12-timestamp11) 秒
- 总共 - 需要 (timestamp12-timestamp04) 秒
有没有办法构建提供此类信息的基于日志的指标?
【问题讨论】:
-
看起来你可以很容易地用 Python/Ruby/Whatever 编写一个脚本来从日志数据中提取它,但我猜你的意思是别的。也许您可以尝试使问题更明确?
-
我真正的问题是是否有办法在没有外部应用程序的情况下做到这一点,只需使用指标创建 api
标签: google-cloud-platform metrics stackdriver google-cloud-stackdriver