PromQL 技巧

复制标签名

pod_name –> pod:

label_replace(
    container_cpu_system_seconds_total,
    "pod", "$1", "pod_name", "(.*)"
)

新标签名跟其它指标:

sum by (pod)(
    irate(
        (
            label_replace(
                container_cpu_system_seconds_total{container_name!=""},
                "pod", "$1", "pod_name", "(.*)"
            ) * on (namespace,pod) group_left(workload,workload_type) mixin_pod_workload{namespace="$namespace", workload=~"$workload", workload_type=~"$workload_type"}
        )[1m:15s]
    )
)

「真诚赞赏,手留余香」

roc

请我喝杯咖啡?

使用微信扫描二维码完成支付