Report stats on evaluation duration per-branch

This commit is contained in:
Graham Christensen 2018-02-12 08:35:52 -05:00
parent cdb88316b9
commit cc464aebfb
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 12 additions and 2 deletions

View file

@ -244,7 +244,9 @@ fn events() -> Vec<MetricType> {
Metric::counter(
"EvaluationDuration",
"Amount of time spent running evaluations",
None
Some(vec![
("branch", "String"),
]),
),
Metric::ticker(
"JobDecodeSuccess",

View file

@ -11,7 +11,7 @@ use std::path::PathBuf;
use ofborg::checkout;
use ofborg::message::{massrebuildjob, buildjob};
use ofborg::nix::Nix;
use std::time::Instant;
use ofborg::acl::ACL;
use ofborg::stats;
use ofborg::stats::Event;
@ -186,6 +186,8 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
hubcaps::statuses::State::Pending,
);
let target_branch_rebuild_sniff_start = Instant::now();
if let Err(mut output) = rebuildsniff.find_before() {
overall_status.set_url(make_gist(
&gists,
@ -201,6 +203,12 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
return self.actions().skip(&job);
}
self.events.notify(
Event::EvaluationDuration(
target_branch.clone(),
target_branch_rebuild_sniff_start.elapsed().as_secs(),
)
);
overall_status.set_with_description("Fetching PR", hubcaps::statuses::State::Pending);