Search code examples
prometheus

Concept of process_cpu_seconds_total in prometheus


This is the result of process cpu seconds total for 5 minutes?

process_cpu_seconds_total{instance="localhost:9090", job="prometheus"}
50.61 @1711710744.158
50.68 @1711710759.167
50.73 @1711710774.155
50.78 @1711710789.155
50.86 @1711710804.195
50.94 @1711710819.155
51 @1711710834.155
51.07 @1711710849.158
51.18 @1711710864.155
51.24 @1711710879.158
51.31 @1711710894.157
51.4 @1711710909.159
51.48 @1711710924.155
51.53 @1711710939.155
51.58 @1711710954.155
51.64 @1711710969.155
51.8 @1711710984.158
51.86 @1711710999.155
51.93 @1711711014.155
52.02 @1711711029.164

Can anyone explain to me how to read and understand this?


Solution

  • Out of the box from prometheus, process_cpu_seconds_total means

    # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
    

    In your example, it is giving you the CPU usage for the instance="localhost:9090", job="prometheus". The value:

        50.61 @1711710744.158
        52.02 @1711711029.164
    
    it used 50.61 seconds at GMT: Friday, March 29, 2024 11:12:24.158 AM
    it used 52.02 seconds at GMT: Friday, March 29, 2024 11:17:09.164 AM
    

    1711710744.158 - this is the timestamp in epoch, which is what prometheus uses. So the above values are showing you the CPU usage for the last 5minutes when you ran it.