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

feat(storage): add metrics for compaction result check #14860

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-user-dashboard.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions grafana/risingwave-dev-dashboard.dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ def section_compaction(outer_panels):
f"sum({metric('storage_level_compact_frequency', successful_compaction_fiiler)}) by (compactor, group, task_type, result)",
"{{task_type}} - {{result}} - group-{{group}} @ {{compactor}}",
),
panels.target(
f"sum({metric('storage_compaction_result_check_count')}) by (compactor, type)",
"{{type}} @ {{compactor}}",
),
],
),
panels.timeseries_count(
Expand Down
2 changes: 1 addition & 1 deletion grafana/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion grafana/risingwave-user-dashboard.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/storage/src/hummock/compactor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ pub fn start_compactor(
tracing::warn!(error = %e.as_report(), "Failed to report task {task_id:?}");
}
if enable_check_compaction_result && need_check_task {
context.compactor_metrics.compaction_result_check_count.with_label_values(&["compaction"]).inc();
match check_compaction_result(&compact_task, context.clone()).await {
Err(e) => {
tracing::warn!(error = %e.as_report(), "Failed to check compaction task {}",compact_task.task_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a metric to record failure happen in the check?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in shared_buffer_compact.rs L269

Expand Down
5 changes: 5 additions & 0 deletions src/storage/src/hummock/compactor/shared_buffer_compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ async fn compact_shared_buffer(
level0.extend(ssts);
}
if context.storage_opts.check_compaction_result {
context
.compactor_metrics
.compaction_result_check_count
.with_label_values(&["flush"])
.inc();
let compaction_executor = context.compaction_executor.clone();
let mut forward_iters = Vec::with_capacity(payload.len());
let del_iter = ForwardMergeRangeIterator::new(HummockEpoch::MAX);
Expand Down
10 changes: 9 additions & 1 deletion src/storage/src/monitor/compactor_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct CompactorMetrics {
pub sstable_distinct_epoch_count: Histogram,
pub compaction_event_consumed_latency: Histogram,
pub compaction_event_loop_iteration_latency: Histogram,
pub compaction_result_check_count: GenericCounterVec<AtomicU64>,
}

pub static GLOBAL_COMPACTOR_METRICS: LazyLock<CompactorMetrics> =
Expand Down Expand Up @@ -250,7 +251,13 @@ impl CompactorMetrics {
);
let compaction_event_loop_iteration_latency =
register_histogram_with_registry!(opts, registry).unwrap();

let compaction_result_check_count = register_int_counter_vec_with_registry!(
"storage_compaction_result_check_count",
"KBs read from current level during history compactions to next level",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description should be modified accordingly.

&["type"],
registry
)
.unwrap();
Self {
compaction_upload_sst_counts,
compact_fast_runner_bytes,
Expand All @@ -277,6 +284,7 @@ impl CompactorMetrics {
sstable_distinct_epoch_count,
compaction_event_consumed_latency,
compaction_event_loop_iteration_latency,
compaction_result_check_count,
}
}

Expand Down
Loading