mirror of
git://git.savannah.gnu.org/guix/guix-cuirass.git
synced 2023-12-14 06:03:04 +01:00
Update metrics in a single transaction.
* src/cuirass/metrics.scm (db-update-metrics): Update all metrics in a single transaction.
This commit is contained in:
parent
038150a3d0
commit
514f20a9b5
1 changed files with 35 additions and 33 deletions
|
@ -328,41 +328,43 @@ timestamp) VALUES ("
|
|||
|
||||
(define (db-update-metrics)
|
||||
"Compute and update all available metrics in database."
|
||||
(define specifications
|
||||
(map (cut assq-ref <> #:name) (db-get-specifications)))
|
||||
(with-db-worker-thread db
|
||||
;; We can not update all evaluations metrics for performance reasons.
|
||||
;; Limit to the evaluations that were added during the past three days.
|
||||
(let ((specifications
|
||||
(map (cut assq-ref <> #:name) (db-get-specifications)))
|
||||
(evaluations (db-latest-evaluations)))
|
||||
(sqlite-exec db "BEGIN TRANSACTION;")
|
||||
|
||||
;; We can not update all evaluations metrics for performance reasons. Limit
|
||||
;; to the evaluations that were added during the past three days.
|
||||
(define evaluations
|
||||
(db-latest-evaluations))
|
||||
(db-update-metric 'builds-per-day)
|
||||
(db-update-metric 'new-derivations-per-day)
|
||||
(db-update-metric 'pending-builds)
|
||||
|
||||
(db-update-metric 'builds-per-day)
|
||||
(db-update-metric 'new-derivations-per-day)
|
||||
(db-update-metric 'pending-builds)
|
||||
;; Update specification related metrics.
|
||||
(for-each (lambda (spec)
|
||||
(db-update-metric
|
||||
'average-10-last-eval-duration-per-spec spec)
|
||||
(db-update-metric
|
||||
'average-100-last-eval-duration-per-spec spec)
|
||||
(db-update-metric
|
||||
'average-eval-duration-per-spec spec)
|
||||
|
||||
;; Update specification related metrics.
|
||||
(for-each (lambda (spec)
|
||||
(db-update-metric
|
||||
'average-10-last-eval-duration-per-spec spec)
|
||||
(db-update-metric
|
||||
'average-100-last-eval-duration-per-spec spec)
|
||||
(db-update-metric
|
||||
'average-eval-duration-per-spec spec)
|
||||
(db-update-metric
|
||||
'percentage-failure-10-last-eval-per-spec spec)
|
||||
(db-update-metric
|
||||
'percentage-failure-100-last-eval-per-spec spec)
|
||||
(db-update-metric
|
||||
'percentage-failed-eval-per-spec spec))
|
||||
specifications)
|
||||
|
||||
(db-update-metric
|
||||
'percentage-failure-10-last-eval-per-spec spec)
|
||||
(db-update-metric
|
||||
'percentage-failure-100-last-eval-per-spec spec)
|
||||
(db-update-metric
|
||||
'percentage-failed-eval-per-spec spec))
|
||||
specifications)
|
||||
;; Update evaluation related metrics.
|
||||
(for-each (lambda (evaluation)
|
||||
(db-update-metric
|
||||
'average-eval-build-start-time evaluation)
|
||||
(db-update-metric
|
||||
'average-eval-build-complete-time evaluation)
|
||||
(db-update-metric
|
||||
'evaluation-completion-speed evaluation))
|
||||
evaluations)
|
||||
|
||||
;; Update evaluation related metrics.
|
||||
(for-each (lambda (evaluation)
|
||||
(db-update-metric
|
||||
'average-eval-build-start-time evaluation)
|
||||
(db-update-metric
|
||||
'average-eval-build-complete-time evaluation)
|
||||
(db-update-metric
|
||||
'evaluation-completion-speed evaluation))
|
||||
evaluations))
|
||||
(sqlite-exec db "COMMIT;"))))
|
||||
|
|
Loading…
Reference in a new issue