Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metric for progress report by kind #737

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/server/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use prometheus::{Histogram, HistogramVec, IntCounter, IntCounterVec, IntGauge, I
const JOBS_METRIC: &str = "crater_completed_jobs_total";
const AGENT_WORK_METRIC: &str = "crater_agent_supposed_to_work";
const AGENT_FAILED: &str = "crater_agent_failure";
const PROGRESS_REPORT: &str = "crater_progress_report";
const LAST_CRATES_UPDATE_METRIC: &str = "crater_last_crates_update";
const ENDPOINT_TIME: &str = "crater_endpoint_time_seconds";
const WORKER_COUNT: &str = "crater_worker_count";
Expand All @@ -22,6 +23,7 @@ pub struct Metrics {
pub crater_endpoint_time: HistogramVec,
crater_worker_count: IntGauge,
pub result_log_size: Histogram,
pub crater_progress_report: IntCounterVec,
}

impl Metrics {
Expand All @@ -36,6 +38,11 @@ impl Metrics {
let failure_opts = prometheus::opts!(AGENT_FAILED, "total completed jobs");
let crater_agent_failure =
prometheus::register_int_counter_vec!(failure_opts, &["agent", "experiment"])?;
let crater_progress_report_opts = prometheus::opts!(PROGRESS_REPORT, "progress report");
let crater_progress_report = prometheus::register_int_counter_vec!(
crater_progress_report_opts,
&["experiment", "kind"]
)?;
let agent_opts = prometheus::opts!(AGENT_WORK_METRIC, "is agent supposed to work");
let crater_work_status = prometheus::register_int_gauge_vec!(agent_opts, &["agent"])?;
let crates_update_opts =
Expand All @@ -60,6 +67,7 @@ impl Metrics {
Ok(Metrics {
crater_completed_jobs_total,
crater_bounced_record_progress,
crater_progress_report,
crater_agent_failure,
crater_work_status,
crater_last_crates_update,
Expand Down
8 changes: 8 additions & 0 deletions src/server/routes/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ impl RecordProgressThread {
.crater_endpoint_time
.with_label_values(&["record_progress_worker"])
.observe(start.elapsed().as_secs_f64());

metrics
.crater_progress_report
.with_label_values(&[
ex.name.as_str(),
&result.data.result.result.to_string(),
])
.inc();
}
}));
});
Expand Down
Loading