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

refactor(metrics): use LabelGuarded for vec metrics in StreamingMetrics #16737

Merged
merged 14 commits into from
May 28, 2024

Conversation

yuhao-su
Copy link
Contributor

@yuhao-su yuhao-su commented May 13, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

close #16728
related #12805

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@yuhao-su yuhao-su enabled auto-merge May 14, 2024 15:45
@yuhao-su yuhao-su disabled auto-merge May 14, 2024 15:45
@yuhao-su yuhao-su marked this pull request as draft May 15, 2024 01:35
@yuhao-su yuhao-su marked this pull request as ready for review May 18, 2024 02:30
@yuhao-su yuhao-su requested a review from wenym1 May 21, 2024 15:51
Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

src/stream/src/executor/mview/materialize.rs Outdated Show resolved Hide resolved
src/stream/src/executor/aggregation/distinct.rs Outdated Show resolved Hide resolved
src/stream/src/executor/hash_agg.rs Outdated Show resolved Hide resolved
src/stream/src/executor/source/fs_source_executor.rs Outdated Show resolved Hide resolved
src/stream/src/executor/source/source_executor.rs Outdated Show resolved Hide resolved
src/stream/src/executor/top_n/group_top_n.rs Outdated Show resolved Hide resolved
src/stream/src/executor/top_n/group_top_n_appendonly.rs Outdated Show resolved Hide resolved
src/stream/src/executor/managed_state/join/mod.rs Outdated Show resolved Hide resolved
@yuhao-su yuhao-su requested review from stdrc and wenym1 May 24, 2024 17:35
@yuhao-su
Copy link
Contributor Author

Should I merge this first and let @stdrc do the rest?

@stdrc
Copy link
Contributor

stdrc commented May 24, 2024

Should I merge this first and let @stdrc do the rest?

Can you wait for me? Will do it on the next work day.

@yuhao-su
Copy link
Contributor Author

Should I merge this first and let @stdrc do the rest?

Can you wait for me? Will do it on the next work day.

sure! Thanks

stdrc added 6 commits May 27, 2024 13:34
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
@stdrc
Copy link
Contributor

stdrc commented May 27, 2024

I've refactored the Agg and GroupTopN part, also resolved some comment related to Source. PTAL, thanks!

Signed-off-by: Richard Chien <stdrc@outlook.com>
Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Rest LGTM!

@@ -180,18 +186,14 @@ impl<S: StateStore> ColumnDeduplicater<S> {
}

/// Flush the deduplication table.
fn flush(&mut self, dedup_table: &StateTable<S>, ctx: ActorContextRef) {
fn flush(&mut self, _dedup_table: &StateTable<S>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that we won't flush the dedup_table anymore here. May remove the parameter and also update the method comment and the method name to avoid confusion.

) -> StreamResult<Self> {
let metrics_info = MetricsInfo::new(
ctx.streaming_metrics.clone(),
state_table.table_id(),
ctx.id,
"GroupTopN",
"AppendOnlyGroupTopN",
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously it was GroupTopN. Was it a bug?

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps not, here is inside InnerAppendOnlyGroupTopNExecutor

.map(AsRef::as_ref)
.collect::<Vec<&str>>(),
)
.with_guarded_label_values(&self.get_metric_labels().each_ref().map(AsRef::as_ref))
Copy link
Contributor

Choose a reason for hiding this comment

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

A remaining temporary with_guarded_label_values. Is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

Thanks for the great work!

) -> StreamResult<Self> {
let metrics_info = MetricsInfo::new(
ctx.streaming_metrics.clone(),
state_table.table_id(),
ctx.id,
"GroupTopN",
"AppendOnlyGroupTopN",
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps not, here is inside InnerAppendOnlyGroupTopNExecutor

@yuhao-su yuhao-su enabled auto-merge May 28, 2024 16:59
@yuhao-su yuhao-su added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 66df1d3 May 28, 2024
27 of 28 checks passed
@yuhao-su yuhao-su deleted the yuhao/guarded-metrics-stream branch May 28, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor StreamingMetrics with LabelGuarded ones
4 participants