@@ -18,6 +18,7 @@ def self.allow_pid_label
1818
1919 DURATION_BUCKETS = [ 5 , 10 , 30 , 60 , 300 , 600 , 890 ] . freeze
2020 CONNECTION_DURATION_BUCKETS = [ 0.001 , 0.005 , 0.01 , 0.05 , 0.1 , 0.5 , 1 , 5 , 10 ] . freeze
21+ QUERY_COUNT_BUCKETS = [ 1 , 5 , 10 , 25 , 50 , 100 , 200 ] . freeze
2122 DELAYED_JOB_METRIC_BUCKETS = [ 0.01 , 0.05 , 0.1 , 0.5 , 1 , 2 , 5 , 10 , 30 , 60 , 120 , 300 , 600 ] . freeze
2223
2324 METRICS = [
@@ -29,6 +30,7 @@ def self.allow_pid_label
2930 { type : :histogram , name : :cc_staging_failed_duration_seconds , docstring : 'Durations of failed staging events' , buckets : DURATION_BUCKETS } ,
3031 { type : :gauge , name : :cc_requests_outstanding_total , docstring : 'Requests outstanding' , aggregation : :sum } ,
3132 { type : :counter , name : :cc_requests_completed_total , docstring : 'Requests completed' } ,
33+ { type : :histogram , name : :cc_db_queries_per_request , docstring : 'DB queries per request' , buckets : QUERY_COUNT_BUCKETS } ,
3234 { type : :gauge , name : :cc_vitals_started_at , docstring : 'CloudController Vitals: started_at' , aggregation : :most_recent } ,
3335 { type : :gauge , name : :cc_vitals_mem_bytes , docstring : 'CloudController Vitals: mem_bytes' , aggregation : :most_recent } ,
3436 { type : :gauge , name : :cc_vitals_cpu_load_avg , docstring : 'CloudController Vitals: cpu_load_avg' , aggregation : :most_recent } ,
@@ -189,6 +191,10 @@ def report_staging_failure_metrics(duration_ns)
189191 update_histogram_metric ( :cc_staging_failed_duration_seconds , nanoseconds_to_seconds ( duration_ns ) )
190192 end
191193
194+ def record_db_query_count ( count )
195+ update_histogram_metric ( :cc_db_queries_per_request , count )
196+ end
197+
192198 private
193199
194200 def register ( metric )
0 commit comments