@@ -50,6 +50,7 @@ const (
5050 workerErrorsMetricName MetricName = "cloudflare_worker_errors_count"
5151 workerCPUTimeMetricName MetricName = "cloudflare_worker_cpu_time"
5252 workerDurationMetricName MetricName = "cloudflare_worker_duration"
53+ workerWallTimeMetricName MetricName = "cloudflare_worker_wall_time"
5354 poolHealthStatusMetricName MetricName = "cloudflare_zone_pool_health_status"
5455 poolRequestsTotalMetricName MetricName = "cloudflare_zone_pool_requests_total"
5556 poolOriginHealthStatusMetricName MetricName = "cloudflare_pool_origin_health_status"
@@ -258,6 +259,12 @@ var (
258259 }, []string {"script_name" , "account" , "status" , "quantile" },
259260 )
260261
262+ workerWallTime = prometheus .NewGaugeVec (prometheus.GaugeOpts {
263+ Name : workerWallTimeMetricName .String (),
264+ Help : "Wall time quantiles by script name (microseconds)" ,
265+ }, []string {"script_name" , "account" , "status" , "quantile" },
266+ )
267+
261268 poolHealthStatus = prometheus .NewGaugeVec (prometheus.GaugeOpts {
262269 Name : poolHealthStatusMetricName .String (),
263270 Help : "Reports the health of a pool, 1 for healthy, 0 for unhealthy." ,
@@ -368,6 +375,7 @@ func buildAllMetricsSet() MetricsSet {
368375 allMetricsSet .Add (workerErrorsMetricName )
369376 allMetricsSet .Add (workerCPUTimeMetricName )
370377 allMetricsSet .Add (workerDurationMetricName )
378+ allMetricsSet .Add (workerWallTimeMetricName )
371379 allMetricsSet .Add (poolHealthStatusMetricName )
372380 allMetricsSet .Add (poolOriginHealthStatusMetricName )
373381 allMetricsSet .Add (poolRequestsTotalMetricName )
@@ -487,6 +495,9 @@ func mustRegisterMetrics(deniedMetrics MetricsSet) {
487495 if ! deniedMetrics .Has (workerDurationMetricName ) {
488496 prometheus .MustRegister (workerDuration )
489497 }
498+ if ! deniedMetrics .Has (workerWallTimeMetricName ) {
499+ prometheus .MustRegister (workerWallTime )
500+ }
490501 if ! deniedMetrics .Has (poolHealthStatusMetricName ) {
491502 prometheus .MustRegister (poolHealthStatus )
492503 }
@@ -588,6 +599,10 @@ func fetchWorkerAnalytics(account cfaccounts.Account, wg *sync.WaitGroup) {
588599 workerDuration .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P75" }).Set (float64 (w .Quantiles .DurationP75 ))
589600 workerDuration .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P99" }).Set (float64 (w .Quantiles .DurationP99 ))
590601 workerDuration .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P999" }).Set (float64 (w .Quantiles .DurationP999 ))
602+ workerWallTime .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P50" }).Set (float64 (w .Quantiles .WallTimeP50 ))
603+ workerWallTime .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P75" }).Set (float64 (w .Quantiles .WallTimeP75 ))
604+ workerWallTime .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P99" }).Set (float64 (w .Quantiles .WallTimeP99 ))
605+ workerWallTime .With (prometheus.Labels {"script_name" : w .Dimensions .ScriptName , "account" : accountName , "status" : w .Dimensions .Status , "quantile" : "P999" }).Set (float64 (w .Quantiles .WallTimeP999 ))
591606 }
592607 }
593608}
0 commit comments