Search code examples
prometheusgrafanadashboardmetricsmonitor

Apply prometheus metric for specific deployment


This metrics return the runnig time of specific pod

sum by(namespace, pod) (

   (last_over_time(kube_pod_completion_time[1d]) 
   - last_over_time(kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"}[1d])) 

  or 

    (time() - kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"})

)

and this

kube_pod_created{})

return all pods how can I make it retrun only result from specific deployment ?


Solution

  • I'v found a solution that worked for me I'v added

    pod=~"consumer-deployment.*"
    

    so it list only pods start with that prefix

    final query is

    kube_pod_created{pod=~"consumer-deployment.*"}