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

Add options to Cassandra to control indexing #680

Merged
merged 4 commits into from
Feb 6, 2018

Conversation

vprithvi
Copy link
Contributor

@vprithvi vprithvi commented Feb 5, 2018

  • Add StoreIndexesOnly and StoreWithoutIndexing options to the cassandra
    storage which controls whether indexes are written along with spans.

  • This allows us to deploy, scale, and prioritize writers independently for
    indexing and storage workloads.

Signed-off-by: Prithvi Raj p.r@uber.com

- Add `StoreIndexesOnly` and `StoreWithoutIndexing` options to the cassandra
  storage which controls whether indexes are written along with spans.

- This allows us to deploy, scale, and prioritize  writers independently for
  indexing and storage workloads.

Signed-off-by: Prithvi Raj <p.r@uber.com>
@@ -63,8 +63,13 @@ const (
defaultNumBuckets = 10

durationBucketSize = time.Hour

indexOnly = storageMode(1)
Copy link
Member

Choose a reason for hiding this comment

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

  • use the iota pattern
  • I would put indexAndStore as the first item (the default mode)

@coveralls
Copy link

coveralls commented Feb 5, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 8fd8d34 on add-cassandra-writer-options into 851b0dd on master.

Signed-off-by: Prithvi Raj <p.r@uber.com>
const (
indexAndStore = storageMode(iota)
indexOnly = storageMode(iota)
storeOnly = storageMode(iota)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

e.g.

const (
	Spring = Season(iota)
	Summer
	Autumn
	Winner
)

@@ -65,6 +65,13 @@ const (
durationBucketSize = time.Hour
)

const (
Copy link
Member

Choose a reason for hiding this comment

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

above section is already "const", don't need to start a new one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to reset the index of iota, and it seems that it only happens in a new const block according to https://golang.org/ref/spec#Iota

Signed-off-by: Prithvi Raj <p.r@uber.com>
}
if err := s.writeIndexes(span, ds); err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

duplication of code is a sign of design problem. You could use bitmasks instead of iota-based constants

Copy link
Contributor Author

@vprithvi vprithvi Feb 5, 2018

Choose a reason for hiding this comment

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

That was what I was doing previously in 7509d91#diff-6eb76ee5c7e114abadac32d9b372742fR135

Copy link
Member

Choose a reason for hiding this comment

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

I like the previous version better, why did you change it? We might have gotten the wires crossed. If your original version of the constants was bitmap-based, then it wasn't clear from the code - I would just declare two constants, saveSpanFlag 1 and indexSpanFlag 2, and add a comment that they can be combined in a bitmap (also name the struct variable somethingFlags)

Copy link
Contributor Author

@vprithvi vprithvi Feb 5, 2018

Choose a reason for hiding this comment

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

I thought that we wanted the default of indexing and storing to have an ordinal of 0; which didn't seem compatible with the previous approach.

I add the flags, and named them as suggested. I didn't add the comment because people would be setting these using options.

Copy link
Member

Choose a reason for hiding this comment

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

if we're not using the sequential enum then it doesn't matter.

Signed-off-by: Prithvi Raj <p.r@uber.com>
@vprithvi vprithvi merged commit ee916be into master Feb 6, 2018
@ghost ghost removed the review label Feb 6, 2018
@vprithvi vprithvi deleted the add-cassandra-writer-options branch February 6, 2018 16:20
@@ -38,15 +38,16 @@ type spanWriterTest struct {
writer *SpanWriter
}

func withSpanWriter(writeCacheTTL time.Duration, fn func(w *spanWriterTest)) {
func withSpanWriter(writeCacheTTL time.Duration, fn func(w *spanWriterTest), options ...Option,
) {
Copy link
Member

Choose a reason for hiding this comment

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

same line

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

4 participants