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

Deprecate vttablet metrics QueryCacheXX and rename to QueryPlanCacheXX #16289

Merged
merged 8 commits into from
Jul 17, 2024

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented Jun 28, 2024

Description

This PR is a follow up of #14947, where we added two new metrics but in the end we would like to rename to TabletQueryPlanCache for more clarity and to avoid the ambiguity with an actual query cache.

All the QueryCacheXX metrics in VTTablet are renamed.

We will need to update the release notes of v20.0.0 and backport only the release notes change to release-20.0, I am adding the backport to label, but the backport should not be merge without changing its content.

Before

image image

After

image image

Copy link
Contributor

vitess-bot bot commented Jun 28, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Jun 28, 2024
@frouioui frouioui added Type: Internal Cleanup Component: VTTablet Backport to: release-20.0 Needs to be backport to release-20.0 Component: Observability Pull requests that touch tracing/metrics/monitoring and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jun 28, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Jun 28, 2024
@@ -99,7 +99,6 @@ hotRowProtection:
consolidator: enable|disable|notOnPrimary # enable-consolidator, enable-consolidator-replicas
passthroughDML: false # queryserver-config-passthrough-dmls
streamBufferSize: 32768 # queryserver-config-stream-buffer-size
queryCacheSize: 5000 # queryserver-config-query-cache-size
Copy link
Member Author

Choose a reason for hiding this comment

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

This flag was removed a while ago, I took the liberty of removing this from the config file.

Signed-off-by: Florent Poinsard <[email protected]>
@frouioui frouioui changed the title Deprecate vttablet metrics QueryCacheXX and rename to QueryPlanCacheXX Deprecate vttablet metrics QueryCacheXX and rename to TabletQueryPlanCacheXX Jun 28, 2024
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 61.53846% with 10 lines in your changes missing coverage. Please review.

Project coverage is 68.68%. Comparing base (75aee8a) to head (ade9210).
Report is 7 commits behind head on main.

Files Patch % Lines
go/vt/vttablet/tabletserver/query_engine.go 66.66% 8 Missing ⚠️
go/vt/vttablet/tabletserver/debugenv.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16289      +/-   ##
==========================================
- Coverage   68.68%   68.68%   -0.01%     
==========================================
  Files        1548     1548              
  Lines      199081   199103      +22     
==========================================
  Hits       136747   136747              
- Misses      62334    62356      +22     

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

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

Can you please address the naming issue?
For metrics PRs, we should always provide a screenshot showing the changed section from the output of the /metrics endpoint and /debug/vars endpoint. Looking at /metrics would have immediately shown you what I said in my review comment.


> [!NOTE]
> `QueryCache` does not refer to a query cache, but to a query plan cache.
> In v21, these metrics will be deprecated and replaced by `TabletQueryPlanCacheHits` and `TabletQueryPlanCacheMisses`.
Copy link
Member

Choose a reason for hiding this comment

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

The reason metric names are not prefixed with Tablet or Gate is that the binary name is automatically added to the metric name as a prefix. So this becomes vttablet_query_plan_cache_misses if you look at /metrics.
All of the metrics introduced in this PR need to be renamed and the Tablet prefix should be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you just need to drop the last commit!

Copy link
Member Author

Choose a reason for hiding this comment

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

That won't work as the vtgate and vttablet metrics will have the same name in vtcombo, leading to a panic/failure.

Copy link
Member Author

@frouioui frouioui Jun 28, 2024

Choose a reason for hiding this comment

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

I will have to see how I can tweak vtcombo. We might already have this situation where the same name is used by both vtgate and vttablet in vtcombo.

@deepthi deepthi added the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Jun 28, 2024
@deepthi
Copy link
Member

deepthi commented Jun 28, 2024

Why not do a separate PR just for the v20 release notes? then this can take as much time as necessary.

@frouioui
Copy link
Member Author

Why not do a separate PR just for the v20 release notes? then this can take as much time as necessary.

That's a good point: #16299

@frouioui frouioui marked this pull request as draft June 28, 2024 21:43
@frouioui frouioui marked this pull request as ready for review July 15, 2024 20:21
@frouioui frouioui requested a review from deepthi July 15, 2024 20:30
Signed-off-by: Florent Poinsard <[email protected]>
Comment on lines -200 to -201
initialHits := qe.queryCacheHits.Get()
initialMisses := qe.queryCacheMisses.Get()
Copy link
Member

Choose a reason for hiding this comment

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

In order to ensure that we keep testing the old metrics until we delete them, we should keep the tests for them. That will require keeping the struct members also around until the metrics are deleted. Each vttablet has one instance of the queryEngine, so it should not be a big deal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done via ade9210

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

We should do a similar PR for vtgate after this is complete.

Signed-off-by: Florent Poinsard <[email protected]>
@frouioui
Copy link
Member Author

frouioui commented Jul 15, 2024

We should do a similar PR for vtgate after this is complete.

VTGate is already using the proper name.

stats.NewGaugeFunc("QueryPlanCacheLength", "Query plan cache length", func() int64 {
return int64(e.plans.Len())
})
stats.NewGaugeFunc("QueryPlanCacheSize", "Query plan cache size", func() int64 {
return int64(e.plans.UsedCapacity())
})
stats.NewGaugeFunc("QueryPlanCacheCapacity", "Query plan cache capacity", func() int64 {
return int64(e.plans.MaxCapacity())
})
stats.NewCounterFunc("QueryPlanCacheEvictions", "Query plan cache evictions", func() int64 {
return e.plans.Metrics.Evicted()
})
stats.NewCounterFunc("QueryPlanCacheHits", "Query plan cache hits", func() int64 {
return e.plans.Metrics.Hits()
})
stats.NewCounterFunc("QueryPlanCacheMisses", "Query plan cache misses", func() int64 {
return e.plans.Metrics.Hits()
})

@frouioui frouioui requested a review from deepthi July 15, 2024 22:24
@deepthi deepthi removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work Backport to: release-20.0 Needs to be backport to release-20.0 labels Jul 17, 2024
@frouioui frouioui merged commit 7782275 into vitessio:main Jul 17, 2024
127 of 128 checks passed
@frouioui frouioui deleted the deprecate-querycache-metrics branch July 17, 2024 21:04
frouioui added a commit to frouioui/vitess that referenced this pull request Jul 19, 2024
@deepthi deepthi changed the title Deprecate vttablet metrics QueryCacheXX and rename to TabletQueryPlanCacheXX Deprecate vttablet metrics QueryCacheXX and rename to QueryPlanCacheXX Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Observability Pull requests that touch tracing/metrics/monitoring Component: VTTablet Type: Internal Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants