普罗米修斯规则中的"with query time()"是什么意思



在下面的示例规则中{{带查询"time(("}}{.|first|value|humanizeTimestamp}}}{{end}}?我搜索了普罗米修斯博士,但找不到定义。

- alert: SCPIngressTrafficRateAboveMajorThreshold
annotations:
timestamp: ' {{ with query "time()" }}{{ . | first | value | humanizeTimestamp }}{{ end }} '
description: 'Ingress Traffic Rate at locality: {{$labels.ocscp_locality}} is above major threshold (i.e. 1400 mps)'
summary: 'namespace: {{$labels.kubernetes_namespace}}, podname: {{$labels.kubernetes_pod_name}}, timestamp: {{ with query "time()" }}{{ . | first | value | humanizeTimestamp }}{{ end }}: Current Ingress Traffic Rate is {{ $value | printf "%.2f" }} mps which is above 80 Percent of Max MPS(1700)'
# Provide app and kubernetes_namespace of scp deployed

基本上,它将以更可读的格式显示时间戳。

您可以在Prometheus文档的TEMPLATE REFERENCE部分中看到有关Prometheus函数的更多详细信息。

普罗米修斯文档中的TEMPLATE examples部分有一些很好的例子。

最新更新