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

keyvisualizer: pre-aggregate ranges #98707

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

zachlite
Copy link
Contributor

Previously, there was no bound on the number of ranges that could be propagated to the collectors. After collection, data was downsampled using a simple heurstic to decide if a bucket was worth keeping or if it should be aggregated with its neighbor.

In this commit, I've introduced a function, maybeAggregateBoundaries, to prevent more than keyvisualizer.max_buckets from being propagated to collectors. This pre-aggregation takes the place of the post-collection downsampling. For the first stable release of the key visualizer, I am intentionally sacrificing dynamic resolution and prioritizing boundary stability instead. This trade-off means that the key visualizer will demand less network, memory, and storage resources from the cluster while operating.

Additionally, this PR drops the sample retention time from 14 days to 7 days, and ensures that keyvisualizer.max_buckets is bounded between [1, 1024].

Resolves: #96740
Epic: None
Release note: None

@zachlite zachlite requested review from Santamaura and a team March 15, 2023 19:54
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@Santamaura Santamaura left a comment

Choose a reason for hiding this comment

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

Some small comments

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @zachlite)


pkg/keyvisualizer/spanstatsconsumer/span_stats_consumer.go line 91 at r1 (raw file):

	}

	// combineFactor is factor that boundaries length is reduced by. For example,

nit: is a factor


pkg/keyvisualizer/spanstatsconsumer/span_stats_consumer.go line 100 at r1 (raw file):

	// Iterate through boundaries, incrementing by combineFactor.
	for i := 0; i < combinedLength; i++ {
		startSpan := boundaries[i*combineFactor]

There is no situation where we will end up with an index out of bound error right?


pkg/ui/workspaces/db-console/src/views/keyVisualizer/index.tsx line 170 at r1 (raw file):

    return (
      <div style={{ position: "relative" }}>
        <KeyVisualizerTimeWindow />

If retention period is now only 7 days do we want to remove the two week option?

@zachlite zachlite force-pushed the 230315.keyvis-preaggregation branch from c0d612b to e081b2d Compare March 15, 2023 20:59
Previously, there was no bound on the number of ranges that
could be propagated to the collectors. After collection,
data was downsampled using a simple heurstic to decide if
a bucket was worth keeping or if it should be aggregated with
its neighbor.

In this commit, I've introduced a function, `maybeAggregateBoundaries`,
to prevent more than `keyvisualizer.max_buckets` from being propagated
to collectors. This pre-aggregation takes the place of the post-collection
downsampling. For the first stable release of the key visualizer,
I am intentionally sacrificing dynamic resolution and prioritizing boundary
stability instead. This trade-off means that the key visualizer will
demand less network, memory, and storage resources from the cluster
while operating.

Additionally, this PR drops the sample retention time from 14 days to 7 days,
and ensures that `keyvisualizer.max_buckets` is bounded between [1, 1024].

Resolves: cockroachdb#96740
Epic: None
Release note: None
@zachlite zachlite force-pushed the 230315.keyvis-preaggregation branch from e081b2d to f8ba475 Compare March 15, 2023 21:27
Copy link
Contributor Author

@zachlite zachlite 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 @Santamaura)


pkg/keyvisualizer/spanstatsconsumer/span_stats_consumer.go line 91 at r1 (raw file):

Previously, Santamaura (Alex Santamaura) wrote…

nit: is a factor

fixed.


pkg/keyvisualizer/spanstatsconsumer/span_stats_consumer.go line 100 at r1 (raw file):

Previously, Santamaura (Alex Santamaura) wrote…

There is no situation where we will end up with an index out of bound error right?

Correct, but I'll put a check for good measure.


pkg/ui/workspaces/db-console/src/views/keyVisualizer/index.tsx line 170 at r1 (raw file):

Previously, Santamaura (Alex Santamaura) wrote…

If retention period is now only 7 days do we want to remove the two week option?

No we don't. thanks.

Copy link
Contributor Author

@zachlite zachlite left a comment

Choose a reason for hiding this comment

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

addressed!

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

Copy link
Contributor

@Santamaura Santamaura left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @zachlite)

@zachlite
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 16, 2023

Build failed:

@zachlite
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 16, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Mar 16, 2023

Build succeeded:

@craig craig bot merged commit 898a32a into cockroachdb:master Mar 16, 2023
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.

keyvisualizer: Pre-aggregate boundaries propagated to the collectors
3 participants