Skip to content

Commit

Permalink
renamed cpu thousandth to cpu_millis. (#4053)
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton authored Oct 31, 2023
1 parent df874d6 commit a93216a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion quickwit/quickwit-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl Cluster {
/// This exposes in chitchat some metrics about the CPU usage of cooperative pipelines.
/// The metrics are exposed as follows:
/// Key: pipeline_metrics:<index_uid>:<source_id>
/// Value: 179‰,76MB/s
/// Value: 179m,76MB/s
pub async fn update_self_node_pipeline_metrics(
&self,
pipeline_metrics: &HashMap<&IndexingPipelineId, PipelineMetrics>,
Expand Down
4 changes: 2 additions & 2 deletions quickwit/quickwit-indexing/src/actors/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,13 @@ impl Indexer {

fn update_pipeline_metrics(&mut self, elapsed: Duration, uncompressed_num_bytes: u64) {
let commit_timeout = self.indexer_state.indexing_settings.commit_timeout();
let cpu_thousandth: u16 = if elapsed >= commit_timeout {
let cpu_millis: u16 = if elapsed >= commit_timeout {
1_000
} else {
(elapsed.as_micros() * 1_000 / commit_timeout.as_micros()) as u16
};
self.counters.pipeline_metrics_opt = Some(PipelineMetrics {
cpu_thousandth,
cpu_millis,
throughput_mb_per_sec: (uncompressed_num_bytes / (elapsed.as_millis() as u64 * 1_000))
as u16,
});
Expand Down
8 changes: 2 additions & 6 deletions quickwit/quickwit-proto/src/indexing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,13 @@ impl TryFrom<&str> for IndexingTask {

#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, utoipa::ToSchema)]
pub struct PipelineMetrics {
pub cpu_thousandth: u16,
pub cpu_millis: u16,
pub throughput_mb_per_sec: u16,
}

impl fmt::Display for PipelineMetrics {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"{}‰,{}MB/s",
self.cpu_thousandth, self.throughput_mb_per_sec
)
write!(f, "{}m,{}MB/s", self.cpu_millis, self.throughput_mb_per_sec)
}
}

Expand Down

0 comments on commit a93216a

Please sign in to comment.