-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
tree: move telemetry references to sql package #80771
Conversation
383e6d8
to
4526c12
Compare
hmm, the last commit causes
when i run logic tests locally (make testbaselogic FILES='geospatial'), which is confusing... locally but not on CI though o_o" |
4892c69
to
1a42f0d
Compare
Release note: None
Release note: None
Woops - wrong name used! Intending to backport this to v22.1. Release note: None
Release note: None
Release note: none
Release note: None
Release note: None
Release note: None
Make the map of counters public and only referencing a function, and move initialization to the sql package. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I be annoying? How would you feel about factoring this out even more so that each of these call sites can just pass in the tree
node? We're going to want to record the same telemetry in the declarative schema changer. It'll be easier to factor that out if there's a centralized entry point. I think it'll also make adding future telemetry easier.
Reviewed 2 of 2 files at r1, 4 of 4 files at r2, 2 of 2 files at r3, 2 of 4 files at r4.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of all the PRs, this one makes me feel the most gross.
Reviewed 2 of 4 files at r4, 4 of 4 files at r5, 4 of 4 files at r6, 1 of 5 files at r7.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @otan)
pkg/sql/sem/tree/alter_table.go
line 146 at r5 (raw file):
// // ALTER TABLE t ADD COLUMN a INT CHECK (a < b) func (node *AlterTable) HoistAddColumnConstraints(onHoistedFKConstraint func()) {
:/ this definitely does not feel good
Can you give an example of usage of what you mean by what you just said? |
Instaed of each of these: telemetry.Inc(sqltelemetry.SchemaChangeAlterCounterWithExtra(
tree.GetTableType(n.n.IsSequence, n.n.IsView, n.n.IsMaterialized),
n.n.TelemetryName(),
)) telemetry.Inc(sqltelemetry.SchemaChangeAlterCounterWithExtra("type", n.n.Cmd.TelemetryName())) telemetry.Inc(sqltelemetry.SchemaChangeDropCounter(
tree.GetTableType(false /* isSequence */, true /* isView */, n.n.IsMaterialized),
)) Have: func incrementTelemetryCounter(n tree.Statement) {
switch n := n.(type) {
case *tree.DropView:
telemetry.Inc(sqltelemetry.SchemaChangeDropCounter(
tree.GetTableType(false /* isSequence */, true /* isView */, n.n.IsMaterialized),
))
case *tree.AlterType:
telemetry.Inc(sqltelemetry.SchemaChangeAlterCounterWithExtra("type", n.n.Cmd.TelemetryName()))
case *tree.AlterTableSetSchema:
telemetry.Inc(sqltelemetry.SchemaChangeAlterCounterWithExtra(
tree.GetTableType(n.n.IsSequence, n.n.IsView, n.n.IsMaterialized),
n.n.TelemetryName(),
))
}
} |
Maybe you should just wave me off |
D: i'm a bigger fan of this way as its statically coded that the TelemetryName exists. but if you feel super strong about it, i guess i can do that. (edit: currently i have decided not to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me.
bors r=ajwerner thanks! |
Build succeeded: |
Individual commits should be fairly easy to review by themselves!
There are still indirect references as of writing, but this removes the direct ones!