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

obsservice: export StatementInsightsStatistics #113498

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

maryliag
Copy link
Contributor

@maryliag maryliag commented Oct 31, 2023

commit 1:

obsservice: add stmt insights proto and conversion

Add proto definition for Statement Insights to be
used on Obs Service.
Creates function to copy a insights.Insight to the new
obspb.StatementInsightsStatistics format.

For this version, there are some parameters not being set,
such as contention. Those will be populated on a following
iteration.

Epic: none

Release note: None


commit 2:

obsservice: export StatementInsightsStatistics

This patch hooks into the Flush functionality used
by PersistedSQLStats, in preparation for Insights
to be sent to external o11y systems.
A following PR will do the actual export during the flush.

Lastly, it's acknowledged that the transformation
required here is likely going to be heavy on
allocations. During the prototyping phase however,
we leave the optimization and/or restructuring of
the exported type for the future. For now, we use
a sync.Pool in an effort to reduce allocations/GC.

Release note: none

@maryliag maryliag requested review from a team as code owners October 31, 2023 15:03
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@maryliag maryliag force-pushed the export-insights branch 4 times, most recently from 45eda49 to 8086fac Compare November 1, 2023 18:31
Copy link
Contributor

@abarganier abarganier left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉 Looking good!

Just a couple tiny nits

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)


pkg/obsservice/obspb/obsservice.proto line 85 at r3 (raw file):

enum Status {
  Completed = 0;

nit: for these (Status/Problem/Cause), should we prefix the type name with something like "Insight" (e.g. InsightStatus), so that it's more obvious which event type they pertain to? Just thinking about what this file might look like a year in the future 🙂


pkg/sql/sqlstats/insights/registry.go line 200 at r3 (raw file):

func (s *Statement) CopyTo(
	ctx context.Context, t *Transaction, session Session, other *obspb.StatementInsightsStatistics,

nit: can session be a pointer?

Add proto definition for Statement Insights to be
used on Obs Service.
Creates function to copy a `insights.Statement` to the new
`obspb.StatementInsightsStatistics` format.

For this version, there are some parameters not being set,
such as contention. Those will be populated on a following
iteration.

Epic: none

Release note: None
This patch hooks into the Flush functionality used
by PersistedSQLStats, in preparation for Insights
to be sent to external o11y systems.
A following PR will do the actual export during the flush.

Lastly, it's acknowledged that the transformation
required here is likely going to be heavy on
allocations. During the prototyping phase however,
we leave the optimization and/or restructuring of
the exported type for the future. For now, we use
a sync.Pool in an effort to reduce allocations/GC.

Release note: none
Copy link
Contributor Author

@maryliag maryliag 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 @abarganier)


pkg/obsservice/obspb/obsservice.proto line 85 at r3 (raw file):

Previously, abarganier (Alex Barganier) wrote…

nit: for these (Status/Problem/Cause), should we prefix the type name with something like "Insight" (e.g. InsightStatus), so that it's more obvious which event type they pertain to? Just thinking about what this file might look like a year in the future 🙂

I decided to move them to inside the Statements Insights definition, so it's clear it's part of it, and when using it it would need to add the prefix anyway


pkg/sql/sqlstats/insights/registry.go line 200 at r3 (raw file):

Previously, abarganier (Alex Barganier) wrote…

nit: can session be a pointer?

Done

Copy link
Contributor

@abarganier abarganier left a comment

Choose a reason for hiding this comment

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

:lgtm: - thanks @maryliag!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @maryliag)


pkg/obsservice/obspb/obsservice.proto line 85 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

I decided to move them to inside the Statements Insights definition, so it's clear it's part of it, and when using it it would need to add the prefix anyway

Cool, thanks! LGTM


pkg/sql/sqlstats/insights/registry.go line 200 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

Done

Thanks!

@maryliag
Copy link
Contributor Author

maryliag commented Nov 6, 2023

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 6, 2023

Build succeeded:

@craig craig bot merged commit 70c8f60 into cockroachdb:master Nov 6, 2023
8 checks passed
@maryliag maryliag deleted the export-insights branch November 6, 2023 21:56
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.

None yet

3 participants