Skip to content

Add cassandra index filter#876

Merged
black-adder merged 4 commits intomasterfrom
cassandra_index_filter
Jun 20, 2018
Merged

Add cassandra index filter#876
black-adder merged 4 commits intomasterfrom
cassandra_index_filter

Conversation

@black-adder
Copy link
Copy Markdown
Contributor

Signed-off-by: Won Jun Jang wjang@uber.com

Which problem is this PR solving?

  • There are certain times when you want to skip indexing a certain span. ie for debug spans, the most common use case is that the user will use the traceid directly to find the trace, there's no need to index it by duration, etc.

Short description of the changes

  • Add a new IndexFilter which checks the span and determines whether it should be indexed or not. Defaults to indexing everything

Signed-off-by: Won Jun Jang <wjang@uber.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 19, 2018

Codecov Report

Merging #876 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #876   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         125    126    +1     
  Lines        6046   6057   +11     
=====================================
+ Hits         6046   6057   +11
Impacted Files Coverage Δ
...ugin/storage/cassandra/spanstore/writer_options.go 100% <100%> (ø) ⬆️
plugin/storage/cassandra/spanstore/writer.go 100% <100%> (ø) ⬆️
...torage/cassandra/spanstore/dbmodel/index_filter.go 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d07297b...e30ca8a. Read the comment docs.

type IndexFilter interface {
IndexByDuration(span *Span) bool
IndexByService(span *Span) bool
IndexByOperation(span *Span) bool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is OK, just not a huge fan of the hard coded function names. Constants can accomplish the same thing dynamically:

const (
    durationIndex = iota
    serviceIndex
    operationIndex
)

type IndexFilter func(span *Span, index int)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fair point

Copy link
Copy Markdown
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Perhaps I missed it, but would the possibility of filtering out debug spans come in a later PR?

}, StoreIndexesOnly())
}

type indexFilter struct{}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This filter will filter out everything, right? Would it be more appropriate to name it noNameFilter{}?

@isaachier
Copy link
Copy Markdown
Contributor

@jpkrohling this mechanism could be used to implement that feature as well.

type debugFilter struct
func (debugFilter) IndexByX(span *Span) bool {
    return !span.Context().(jaeger.SpanContext).IsDebug()
}

Signed-off-by: Won Jun Jang <wjang@uber.com>
Signed-off-by: Won Jun Jang <wjang@uber.com>
Signed-off-by: Won Jun Jang <wjang@uber.com>
Copy link
Copy Markdown
Contributor

@isaachier isaachier left a comment

Choose a reason for hiding this comment

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

LGTM

@black-adder
Copy link
Copy Markdown
Contributor Author

@jpkrohling later PR, I promise

@black-adder black-adder merged commit fd5dddd into master Jun 20, 2018
@ghost ghost removed the review label Jun 20, 2018
@black-adder black-adder deleted the cassandra_index_filter branch June 20, 2018 19: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.

4 participants