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

sql: add telemetry for schema changer mode #105108

Merged
merged 2 commits into from
Jun 24, 2023

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Jun 17, 2023

sql: use featureflag check for new schema changer

Now the check uses the statement tag to determine which operation is
running.

I took the opportunity to make sure the statement tags matched with the
ones Postgres returns.


sql: add telemetry for schema changer mode

fixes #99386

This adds feature counter telemetry as well as log based telemetry to
indicate which version of the schema changer was used.

The telemetry keys are:

  • sql.schema.schema_changer_mode.legacy
  • sql.schema.schema_changer_mode.declarative

The new field in the log-based telemetry is:

  • SchemaChangerMode

Release note: None

@rafiss rafiss added backport-22.2.x backport-23.1.x Flags PRs that need to be backported to 23.1 labels Jun 17, 2023
@rafiss rafiss requested a review from a team June 17, 2023 16:45
@rafiss rafiss requested review from a team as code owners June 17, 2023 16:45
@rafiss rafiss requested a review from michae2 June 17, 2023 16:45
@blathers-crl
Copy link

blathers-crl bot commented Jun 17, 2023

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

@rafiss rafiss force-pushed the schema-mode-telemetry branch 2 times, most recently from fdf78a9 to 141747a Compare June 17, 2023 19:29
@rafiss rafiss requested a review from a team as a code owner June 17, 2023 19:29
@rafiss rafiss force-pushed the schema-mode-telemetry branch from 141747a to e48f359 Compare June 17, 2023 20:57
Now the check uses the statement tag to determine which operation is
running.

I took the opportunity to make sure the statement tags matched with the
ones Postgres returns.

Release note: None
@rafiss rafiss force-pushed the schema-mode-telemetry branch from e48f359 to 4a7c315 Compare June 17, 2023 22:23
@rafiss rafiss requested a review from chengxiong-ruan June 20, 2023 15:27
@@ -56,6 +58,9 @@ func buildOpaque(
plan, err = p.SchemaChange(ctx, stmt)
if err != nil {
return nil, err
} else if plan != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

create function has a similar trick since it's not opaque and have to go through optbuilder at the moment:

if plan != nil {

Maybe better to do the counting in p.SchemaChange method, or I'm good with adding an extra counting there as well.

Copy link
Collaborator Author

@rafiss rafiss Jun 24, 2023

Choose a reason for hiding this comment

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

thanks for pointing that out! i added tests for it, and moved the logic to p.SchemaChange

i noticed a few more places with missing telemetry, so made a followup PR: #105482

This adds feature counter telemetry as well as log based telemetry to
indicate which  version of the schema changer was used.

Release note: None
@rafiss
Copy link
Collaborator Author

rafiss commented Jun 24, 2023

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 24, 2023

Build failed:

@rafiss
Copy link
Collaborator Author

rafiss commented Jun 24, 2023

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 24, 2023

Build succeeded:

@craig craig bot merged commit a2c2c06 into cockroachdb:master Jun 24, 2023
@blathers-crl
Copy link

blathers-crl bot commented Jun 24, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from a34ef58 to blathers/backport-release-22.2-105108: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.2.x failed. See errors above.


error creating merge commit from 6192117 to blathers/backport-release-23.1-105108: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


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

@rafiss rafiss deleted the schema-mode-telemetry branch June 26, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql/schemachanger: add telemetry to know which statements are run under declarative vs legacy schema changer
3 participants