@@ -25,7 +25,7 @@ module Metrics = struct
2525
2626 let request_handling =
2727 let help = " Number of handled requests by state" in
28- Gauge. v_label ~label_name: " state" ~help ~namespace ~subsystem " solve_request_state "
28+ Gauge. v_label ~label_name: " state" ~help ~namespace ~subsystem " request_state "
2929
3030 let update_request_handling pool n_requests =
3131 let workers = Pool. n_workers pool in
@@ -36,23 +36,23 @@ module Metrics = struct
3636
3737 let request_ok =
3838 let help = " Total number of success solve requests" in
39- Counter. v ~help ~namespace ~subsystem " success_solve "
39+ Counter. v ~help ~namespace ~subsystem " success "
4040
4141 let request_fail =
4242 let help = " Total number of fail solve requests" in
43- Counter. v ~help ~namespace ~subsystem " fail_solve "
43+ Counter. v ~help ~namespace ~subsystem " failed "
4444
4545 let request_no_solution =
4646 let help = " Total number of no solution solve requests " in
47- Counter. v ~help ~namespace ~subsystem " no_solution_solve "
47+ Counter. v ~help ~namespace ~subsystem " no_solution "
4848
49- let request_cancelled =
50- let help = " Total number of cancel without running solve requests" in
51- Counter. v ~help ~namespace ~subsystem " cancel_without_running_solve "
49+ let request_cancel_waiting =
50+ let help = " Total number of cancel when the requests are waiting " in
51+ Counter. v ~help ~namespace ~subsystem " cancel_waiting "
5252
53- let request_cancelled_after =
54- let help = " Total number of cancel when running solve requests" in
55- Counter. v ~help ~namespace ~subsystem " cancel_when_running_solve "
53+ let request_cancel_running =
54+ let help = " Total number of cancel when the requests are running " in
55+ Counter. v ~help ~namespace ~subsystem " cancel_running "
5656
5757end
5858
@@ -160,8 +160,9 @@ let solve ?cancelled t ~log request =
160160 in
161161 Log. info log " Solving for %a" Fmt. (list ~sep: comma string ) root_pkgs;
162162 let serious_errors = ref [] in
163- let cancels_without_running = ref 0 in
163+ let cancel_waiting = ref 0 in
164164 let n_requests = ref 0 in
165+ let pool = t.pool in
165166 let *! root_pkgs = parse_opams request.root_pkgs in
166167 let *! pinned_pkgs = parse_opams request.pinned_pkgs in
167168 let *! packages = Stores. packages t.stores opam_repository_commits in
@@ -170,7 +171,7 @@ let solve ?cancelled t ~log request =
170171 |> Fiber.List. map (fun (id , vars ) ->
171172 Prometheus.Counter. inc_one Metrics. request_handling_total;
172173 incr n_requests;
173- Metrics. update_request_handling t. pool n_requests;
174+ Metrics. update_request_handling pool n_requests;
174175 let result =
175176 solve_for_platform t id
176177 ?cancelled
@@ -182,12 +183,13 @@ let solve ?cancelled t ~log request =
182183 ~pins
183184 ~vars
184185 in
185- decr n_requests;
186- Metrics. update_request_handling t.pool n_requests;
186+ Metrics. update_request_handling pool n_requests;
187187 (id, result)
188188 )
189189 |> List. filter_map (fun (id , result ) ->
190190 Log. info log " = %s =" id;
191+ decr n_requests;
192+ Metrics. update_request_handling pool n_requests;
191193 match result with
192194 | Ok result ->
193195 Prometheus.Counter. inc_one Metrics. request_ok;
@@ -199,8 +201,8 @@ let solve ?cancelled t ~log request =
199201 result.Selection. commits;
200202 Some result
201203 | Error `Cancelled ->
202- Prometheus.Counter. inc_one Metrics. request_cancelled ;
203- incr cancels_without_running ;
204+ Prometheus.Counter. inc_one Metrics. request_cancel_waiting ;
205+ incr cancel_waiting ;
204206 Log. info log " %s" " Cancelled" ;
205207 None
206208 | Error (`No_solution msg ) ->
@@ -216,8 +218,8 @@ let solve ?cancelled t ~log request =
216218 in
217219 match cancelled with
218220 | Some p when Promise. is_resolved p ->
219- let cancels = (List. length platforms) - (! cancels_without_running ) in
220- Prometheus.Counter. inc Metrics. request_cancelled_after (float_of_int cancels);
221+ let cancels = (List. length platforms) - (! cancel_waiting ) in
222+ Prometheus.Counter. inc Metrics. request_cancel_running (float_of_int cancels);
221223 Error `Cancelled
222224 | _ ->
223225 match ! serious_errors with
0 commit comments