Prometheus 获取维多利亚度量中度量的最后一次看到的值和时间

Prometheus 获取维多利亚度量中度量的最后一次看到的值和时间,prometheus,promql,victoriametrics,Prometheus,Promql,Victoriametrics,我使用victoriametrics从物联网数据记录设备。每次设备向服务器发送心跳信号时,我都会进入虚拟机。有时设备会离线。 在我的应用程序中,我想查询设备在一天中最后一次出现的时间。 我尝试了一些选择,比如 /query? last_over_time(devicerecord_uptime{kd_id="807d3a73e0fd"}[24h]) 及 第一个给出值,但时间戳不是事件的实际时间 "value": [

我使用victoriametrics从物联网数据记录设备。每次设备向服务器发送心跳信号时,我都会进入虚拟机。有时设备会离线。 在我的应用程序中,我想查询设备在一天中最后一次出现的时间。 我尝试了一些选择,比如

/query?
last_over_time(devicerecord_uptime{kd_id="807d3a73e0fd"}[24h])

第一个给出值,但时间戳不是事件的实际时间

"value": [
                    1620822177, // This timestamp is time now, not the time of report
                    "19948"
         ]
第二个给出了值,但它给出了24小时内的所有值。导致带宽增加,效率降低,因为我想为很多设备运行脚本

"values": [
... All day values
    [
        1620822770.508,
        "20848"
    ],
    [
        1620823070.518,
        "21148"
    ],

    [1620823370.528,
        "21448"
    ]
]
有没有正确的方法来获取设备最后一次被看到的时间

第一个给出值,但时间戳不是事件的实际时间

"value": [
                    1620822177, // This timestamp is time now, not the time of report
                    "19948"
         ]
这是特定的/query端点-它在当前时间戳执行即时查询并返回最接近的结果

您是否尝试过“tlast_over_time(m[d])-返回m over d time range的最后一个样本的时间戳”来获取时间戳?请参阅更多详细信息