@@ -15,6 +15,9 @@ const (
1515 ExecutionState = "state"
1616 ExecutionStateFinished = "finished"
1717 ExecutionStateFailed = "failed"
18+
19+ Resource = "resource"
20+ ResourceRSS = "rss"
1821)
1922
2023// InstrumentHTTP uses promhttp to instrument a handler with total, duration, and in-flight requests.
@@ -53,6 +56,7 @@ func InstrumentHTTP(reg prometheus.Registerer, handler http.Handler) http.Handle
5356type SupervisorMetrics struct {
5457 SessionDuration prometheus.Histogram
5558 ChromiumExecutions * prometheus.CounterVec
59+ ChromiumResources * prometheus.HistogramVec
5660}
5761
5862// Supervisor registers and returns handlers for metrics used by the supervisor.
@@ -81,10 +85,25 @@ func Supervisor(reg prometheus.Registerer) *SupervisorMetrics {
8185 },
8286 []string {ExecutionState },
8387 ),
88+ ChromiumResources : prometheus .NewHistogramVec (
89+ prometheus.HistogramOpts {
90+ Namespace : metricNs ,
91+ Subsystem : metricSubsystemCrocochrome ,
92+ Name : "chromium_resource_usage" ,
93+ Help : "Resources used by chromium when the execution ends." +
94+ "Memory resources are expressed in bytes." ,
95+ Buckets : prometheus .LinearBuckets (0 , 64 << 20 , 16 ), // 64Mi*16=1024Mi
96+ NativeHistogramBucketFactor : 1.2 ,
97+ NativeHistogramMaxBucketNumber : 32 ,
98+ NativeHistogramMinResetDuration : 1 * time .Hour ,
99+ },
100+ []string {Resource },
101+ ),
84102 }
85103
86104 reg .MustRegister (m .SessionDuration )
87105 reg .MustRegister (m .ChromiumExecutions )
106+ reg .MustRegister (m .ChromiumResources )
88107
89108 return m
90109}
0 commit comments