0

在此处输入图像描述

report_execution{executionId="1", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api1", whoran="superuser"}

report_execution{executionId="1", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Started", uri="/public/api1", whoran="superuser"}

report_execution{executionId="2", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Completed", uri="/public/api2", whoran="superuser"}

report_execution{executionId="2", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api2", whoran="superuser"}

report_execution{executionId="2", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Started", uri="/public/api2", whoran="superuser"}

report_execution{executionId="3", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Completed", uri="/public/api3", whoran="superuser"}

report_execution{executionId="3", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api3", whoran="superuser"}

report_execution{executionId="3", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Started", uri="/public/api3", whoran="superuser"}

report_execution{executionId="4", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api4", whoran="superuser"}

report_execution{executionId="4", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Started", uri="/public/api4", whoran="superuser"}

每个 executionid 在上面的 prometheus 结果中都有很多状态(Started, Running, Completed)。如何编写 promql 以实现 executionid 只有 Running 状态而不是 Completed 状态的结果?

我的预期结果应该是

report_execution{executionId="1", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api1", whoran="superuser"}

report_execution{executionId="4", exported_job="my_batch_job", instance="localhost:9091", job="pushgateway", status="Running", uri="/public/api4", whoran="superuser"}
4

0 回答 0