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

fix(metrics): use raw metrics vec in connection metrics #14017

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Dec 15, 2023

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

What's changed and what's your intention?

#13981

Previously we use LabelGuardedXxx metrics vec to report connection metrics. We use the label guarded one to prevent label leak. However, the lifetime of the label guarded metrics is within the lifetime of each connection, and for some short connection such as connection with s3, it is used for short time, and is dropped soon, which will cause the label to be dropped and later reset and the metrics will become inaccurate.

However, the label of connection metrics is [connection_type, endpoint]. The set of connection_type is bounded, and endpoint is actually ip, and the set of endpoint is bounded. So for connection metrics, we don't need to use the label guarded metrics. So in this PR, we change to use the raw metrics vec back for connection metrics.

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.

@github-actions github-actions bot added the type/fix Bug fix label Dec 15, 2023
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d1128cb) 68.09% compared to head (79f1348) 68.08%.
Report is 3 commits behind head on main.

Files Patch % Lines
src/common/src/monitor/connection.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14017      +/-   ##
==========================================
- Coverage   68.09%   68.08%   -0.02%     
==========================================
  Files        1543     1543              
  Lines      267096   267096              
==========================================
- Hits       181890   181852      -38     
- Misses      85206    85244      +38     
Flag Coverage Δ
rust 68.08% <94.73%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wenym1 wenym1 enabled auto-merge December 18, 2023 08:40
@wenym1 wenym1 added this pull request to the merge queue Dec 18, 2023
@fuyufjh
Copy link
Member

fuyufjh commented Dec 18, 2023

Wonder if my understanding is correct... Either of the following should be good, right?

  1. Dimension [connection_type, endpoint] + raw metrics, which means the metrics measures traffic between nodes, so it has unlimited lifetime
  2. Dimension [connection_type, endpoint, port]+ LabelGuarded metrics, which means the metrics measures traffic of each connection, so it should have lifetime of the connection

And this PR chose 1. Is this correct?

@wenym1
Copy link
Contributor Author

wenym1 commented Dec 18, 2023

Wonder if my understanding is correct... Either of the following should be good, right?

Dimension [connection_type, endpoint] + raw metrics, which means the metrics measures traffic between nodes, so it has unlimited lifetime
Dimension [connection_type, endpoint, port]+ LabelGuarded metrics, which means the metrics measures traffic of each connection, so it should have lifetime of the connection
And this PR chose 1. Is this correct?

Yes, we chose 1, and before this PR, we already use the dimension [connection_type, ip].

The drawback of 2 is because of the drawback of the current label guarded metrics. For example, when we measure the connection to S3, which has a fixed endpoint, if we use the label guarded metrics, after a query has finished, the connection is dropped, and metrics of the labels will be dropped and reset and may cause the same incorrect metric as #13948, though we will report metrics of the same label very soon when we make the next S3 query.

Merged via the queue into main with commit a0cc54c Dec 18, 2023
26 of 27 checks passed
@wenym1 wenym1 deleted the yiming/connection-raw-metrics-vec branch December 18, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants