Skip to content

metric: add labels for sql.*.started.count #151946

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZhouXing19
Copy link
Collaborator

@ZhouXing19 ZhouXing19 commented Aug 15, 2025

Previously, only metrics for executed SELECT|UPDATE|DELETE|INSERT statements are labeled, while their started equivalent are not labeled. This commit is to label these metrics. Since they are not frequently used metrics, they are not marked as Essential.

Fixes: #152074

Release note (ops change): sql.select.started.count, sql.insert.started.count, sql.update.started.count, sql.delete.started.count are now labeled with sql.count.

Copy link

blathers-crl bot commented Aug 15, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

StaticLabels: metric.MakeLabelPairs(metric.LabelQueryType, "started-select"),
Essential: true,
Category: metric.Metadata_SQL,
HowToUse: "This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you say anything more specific about started vs other metrics that would be helpful here?

I'm also not sure this metric is "essential". Most customers use the executed metrics to count QPS so we should justify why they should also pay attention to these.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I searched Slack and found only 2 threads that explicitly mentioned using the started metrics for troubleshooting:

Additionally, the started metrics was introduced in #37264, which also introduced the executed metrics as a claimed more useful one.

So maybe we should close it for now until receiving explicit ask for this feature?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed the "Essential:true" field per offline discussion.

Previously, only metrics for *executed* `SELECT|UPDATE|DELETE|INSERT`
statements are labeled, while their *started* equivalent are not labeled.
This commit is to label these metrics.

Ref cockroachdb#143536

Release note (ops change): TBD

<what was there before: Previously, ...>
<why it needed to change: This was inadequate because ...>
<what you did about it: To address this, this patch ...>
@ZhouXing19 ZhouXing19 marked this pull request as ready for review August 19, 2025 13:01
@ZhouXing19 ZhouXing19 requested a review from dhartunian August 19, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

metric: add static labels to sql.*.started.count
3 participants