-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make ES index name configurable #1009
Make ES index name configurable #1009
Conversation
3aed9d5
to
69b7216
Compare
Prefix We could make |
Codecov Report
@@ Coverage Diff @@
## master #1009 +/- ##
======================================
Coverage 100% 100%
======================================
Files 139 139
Lines 6399 6414 +15
======================================
+ Hits 6399 6414 +15
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane to me, but I'm not up to speed with the storage parts.
I have changed a couple of things.
|
@yurishkuro @black-adder @vprithvi would you like to have a look? |
func indexName(date time.Time) string { | ||
return dependencyIndexPrefix + date.UTC().Format("2006-01-02") | ||
func indexName(prefix string, date time.Time) string { | ||
return prefix + dependencyIndex + date.UTC().Format("2006-01-02") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we're doing this for every span write? lots of GC pressure. At least we can pre-concatenate the prefix with the constant string in the constructor. Ideally we would cache the mapping from date (sans time) to string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's per span write. Will update not sure if the cache would make a significant difference
plugin/storage/es/esCleaner.py
Outdated
@@ -8,16 +8,23 @@ | |||
|
|||
def main(): | |||
if len(sys.argv) == 1: | |||
print('USAGE: [TIMEOUT=(default 120)] %s NUM_OF_DAYS HOSTNAME[:PORT] ...' % sys.argv[0]) | |||
print('USAGE: [TIMEOUT=(default 120)] [INDEX_PREFIX=(default \'\')] %s NUM_OF_DAYS HOSTNAME[:PORT] ...' % sys.argv[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just say default ""
@@ -74,16 +74,16 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) | |||
// CreateSpanReader implements storage.Factory | |||
func (f *Factory) CreateSpanReader() (spanstore.Reader, error) { | |||
cfg := f.primaryConfig | |||
return esSpanStore.NewSpanReader(f.primaryClient, f.logger, cfg.GetMaxSpanAge(), f.metricsFactory), nil | |||
return esSpanStore.NewSpanReader(f.primaryClient, f.logger, cfg.GetMaxSpanAge(), f.metricsFactory, cfg.GetIndexPrefix()), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this reached the point of needing its own type SpanReaderParams struct{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep the current form for the simplicity. If it grows we can refactor
plugin/storage/es/options.go
Outdated
flagSet.String( | ||
nsConfig.namespace+suffixIndexPrefix, | ||
nsConfig.IndexPrefix, | ||
"The prefix of Jaeger indices. For example \"production\" creates \"production:jaeger-*\". (Default unset)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Optional prefix for index names. (don't need "Default unset")
@@ -147,33 +152,33 @@ func (s *SpanReader) unmarshalJSONSpan(esSpanRaw *elastic.SearchHit) (*jModel.Sp | |||
} | |||
|
|||
// Returns the array of indices that we need to query, based on query params | |||
func findIndices(prefix string, startTime time.Time, endTime time.Time) []string { | |||
func (s *SpanReader) findIndices(indexName string, startTime time.Time, endTime time.Time) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change method name, e.g. indicesForTimeRange
It allow simple multitenancy - index per tenant or k8s namespace. Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
f08f10e
to
ddd8ad0
Compare
* Make ES index name configurable It allow simple multitenancy - index per tenant or k8s namespace. Signed-off-by: Pavol Loffay <ploffay@redhat.com> * docs Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix comment Signed-off-by: Pavol Loffay <ploffay@redhat.com> * index prefix Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix index cleaner and add prefix delimiter Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix dependency storage Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fmt and help message Signed-off-by: Pavol Loffay <ploffay@redhat.com> * increase converage Signed-off-by: Pavol Loffay <ploffay@redhat.com> * review fixes Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Resolves #799
Dependency job PR: jaegertracing/spark-dependencies#38