gpt4 book ai didi

timestamp - 带有时间戳的普罗米修斯指标

转载 作者:行者123 更新时间:2023-12-05 02:12:25 29 4
gpt4 key购买 nike

当我从 prometheus 查询指标时,我只得到查询时的时间戳。

例如,如果我这样查询数据,

http://localhost:9090/api/v1/query?query=go_memstats_buck_hash_sys_bytes

然后我得到如下响应。

{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "go_memstats_buck_hash_sys_bytes",
"instance": "localhost:9090",
"job": "prometheus"
},
"value": [
1557366670.588, <== UNIX time stamp when I queried.
"1472884" <== Value
]
}
]
}
}

但是在图 TableView 中,我可以看到如下图表。这意味着我可以用普罗米修斯的时间戳查询数据。

enter image description here

我想知道如何使用 prometheus 的时间戳查询指标。

最佳答案

我找到了答案,我需要如下时间范围。

http://localhost:9090/api/v1/query?query=go_memstats_buck_hash_sys_bytes[5m]

那么结果就是,

{
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"__name__": "go_memstats_buck_hash_sys_bytes",
"instance": "localhost:9090",
"job": "prometheus"
},
"values": [
[
1557369023.318,
"1491644"
],
[
1557369028.318,
"1491644"
],
[
1557369033.282,
"1491644"
],
.........
]
}
]
}
}

关于timestamp - 带有时间戳的普罗米修斯指标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56051166/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com