Skip to content

sql: add telemetry for ALTER DATABASE PLACEMENT#69006

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
pawalt:placement_telemetry
Aug 18, 2021
Merged

sql: add telemetry for ALTER DATABASE PLACEMENT#69006
craig[bot] merged 2 commits intocockroachdb:masterfrom
pawalt:placement_telemetry

Conversation

@pawalt
Copy link
Copy Markdown
Contributor

@pawalt pawalt commented Aug 16, 2021

This PR adds telemetry for ALTER DATABASE PLACEMENT operations.

Release note: None

Resolves #68597

@pawalt pawalt requested review from a team and arulajmani August 16, 2021 18:46
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@pawalt pawalt requested a review from otan August 16, 2021 18:47
Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

I don't think this PR adds telemetry, it adds support for event logs. We probably want telemetry too, should we do that in a separate PR?

Separately, I think you've got a bit more to do before these event logs work correctly. I suspect if you altered a database's placement policy you wouldn't have it show up correctly in the UI. Does it? Here's an example PR to follow for the last step: https://github.com/cockroachdb/cockroach/pull/63141/files#

Reviewed 3 of 6 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan and @pawalt)


pkg/util/log/eventpb/ddl_events.proto, line 99 at r1 (raw file):

  // The name of the database.
  string database_name = 3 [(gogoproto.jsontag) = ",omitempty"];
  // The new survival goal

Did you mean new placement policy?

This PR adds event logging for ALTER DATABASE PLACEMENT operations.

Release note: None
@pawalt pawalt force-pushed the placement_telemetry branch from e65b369 to f4216b9 Compare August 17, 2021 17:11
@pawalt pawalt requested a review from arulajmani August 17, 2021 17:13
Copy link
Copy Markdown
Contributor Author

@pawalt pawalt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani and @otan)


pkg/util/log/eventpb/ddl_events.proto, line 99 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Did you mean new placement policy?

Oops bad copypasta

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

The telemetry counters are missing test coverage. Check out pkg/ccl/telemetryccl/testdata/telemetry/multiregion, that's probably where we want this stuff.

Reviewed 3 of 6 files at r1, 3 of 3 files at r2, 1 of 3 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani, @otan, and @pawalt)


pkg/sql/alter_database.go, line 1153 at r3 (raw file):

	telemetry.Inc(
		sqltelemetry.AlterDatabaseSurvivalGoalCounter(

Did you mean to call AlterDatabasePlacementCounter here?

@pawalt pawalt force-pushed the placement_telemetry branch from f4216b9 to 659c72d Compare August 17, 2021 19:51
@pawalt pawalt requested a review from arulajmani August 17, 2021 19:51
Copy link
Copy Markdown
Contributor Author

@pawalt pawalt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani and @otan)


pkg/sql/alter_database.go, line 1153 at r3 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Did you mean to call AlterDatabasePlacementCounter here?

Damn could have sworn I changed that. Fixed.

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

One testing request, but otherwise :lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani, @otan, and @pawalt)


pkg/ccl/telemetryccl/testdata/telemetry/multiregion, line 35 at r4 (raw file):


feature-usage
ALTER DATABASE to_be_restricted SET PLACEMENT RESTRICTED

Let's add one for SET PLACEMENT DEFAULT as well? both create and alter database.


pkg/sql/sem/tree/data_placement.go, line 43 at r4 (raw file):

}

// TelemetryName returns a representation of DataPlacement suitable for telemetry

nit: full stop.

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

Sorry, meant to approve.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani, @otan, and @pawalt)

@pawalt pawalt force-pushed the placement_telemetry branch 2 times, most recently from 824793c to fc5eb79 Compare August 18, 2021 14:58
@pawalt pawalt requested a review from arulajmani August 18, 2021 14:58
Copy link
Copy Markdown
Contributor Author

@pawalt pawalt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @arulajmani and @otan)


pkg/ccl/telemetryccl/testdata/telemetry/multiregion, line 35 at r4 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Let's add one for SET PLACEMENT DEFAULT as well? both create and alter database.

Done.

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

:lgtm:

I think you need to update some generated code.

Reviewed all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani and @otan)

This PR adds telemetry for ALTER DATABASE PLACEMENT operations.

Release note: None
@pawalt pawalt force-pushed the placement_telemetry branch from fc5eb79 to d86da34 Compare August 18, 2021 18:46
@pawalt
Copy link
Copy Markdown
Contributor Author

pawalt commented Aug 18, 2021

bors r=arulajmani

@postamar postamar removed the request for review from a team August 18, 2021 20:34
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 18, 2021

Build succeeded:

@craig craig bot merged commit 5506d0b into cockroachdb:master Aug 18, 2021
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.

sql: add telemetry for PLACEMENT operations

3 participants