diff --git a/cmd/es-index-cleaner/app/index_filter.go b/cmd/es-index-cleaner/app/index_filter.go index e7695984a6e..52079e27748 100644 --- a/cmd/es-index-cleaner/app/index_filter.go +++ b/cmd/es-index-cleaner/app/index_filter.go @@ -49,7 +49,7 @@ func (i *IndexFilter) filter(indices []client.Index) []client.Index { // archive works only for rollover reg, _ = regexp.Compile(fmt.Sprintf("^%sjaeger-span-archive-\\d{6}", i.IndexPrefix)) } else if i.Rollover { - reg, _ = regexp.Compile(fmt.Sprintf("^%sjaeger-(span|service)-\\d{6}", i.IndexPrefix)) + reg, _ = regexp.Compile(fmt.Sprintf("^%sjaeger-(span|service|dependencies)-\\d{6}", i.IndexPrefix)) } else { reg, _ = regexp.Compile(fmt.Sprintf("^%sjaeger-(span|service|dependencies)-\\d{4}%s\\d{2}%s\\d{2}", i.IndexPrefix, i.IndexDateSeparator, i.IndexDateSeparator)) } @@ -58,7 +58,10 @@ func (i *IndexFilter) filter(indices []client.Index) []client.Index { for _, in := range indices { if reg.MatchString(in.Index) { // index in write alias cannot be removed - if in.Aliases[i.IndexPrefix+"jaeger-span-write"] || in.Aliases[i.IndexPrefix+"jaeger-service-write"] || in.Aliases[i.IndexPrefix+"jaeger-span-archive-write"] { + if in.Aliases[i.IndexPrefix+"jaeger-span-write"] || + in.Aliases[i.IndexPrefix+"jaeger-service-write"] || + in.Aliases[i.IndexPrefix+"jaeger-span-archive-write"] || + in.Aliases[i.IndexPrefix+"jaeger-dependencies-write"] { continue } filtered = append(filtered, in) diff --git a/cmd/es-rollover/app/index_options.go b/cmd/es-rollover/app/index_options.go index b5e6f9a628d..8a446f36123 100644 --- a/cmd/es-rollover/app/index_options.go +++ b/cmd/es-rollover/app/index_options.go @@ -52,6 +52,11 @@ func RolloverIndices(archive bool, prefix string) []IndexOption { Mapping: "jaeger-service", indexType: "jaeger-service", }, + { + prefix: prefix, + Mapping: "jaeger-dependencies", + indexType: "jaeger-dependencies", + }, } } diff --git a/cmd/es-rollover/app/index_options_test.go b/cmd/es-rollover/app/index_options_test.go index d0e257e0042..6161e603d44 100644 --- a/cmd/es-rollover/app/index_options_test.go +++ b/cmd/es-rollover/app/index_options_test.go @@ -52,6 +52,13 @@ func TestRolloverIndices(t *testing.T) { writeAliasName: "jaeger-service-write", initialRolloverIndex: "jaeger-service-000001", }, + { + templateName: "jaeger-dependencies", + mapping: "jaeger-dependencies", + readAliasName: "jaeger-dependencies-read", + writeAliasName: "jaeger-dependencies-write", + initialRolloverIndex: "jaeger-dependencies-000001", + }, }, }, { @@ -99,6 +106,13 @@ func TestRolloverIndices(t *testing.T) { writeAliasName: "mytenant-jaeger-service-write", initialRolloverIndex: "mytenant-jaeger-service-000001", }, + { + mapping: "jaeger-dependencies", + templateName: "mytenant-jaeger-dependencies", + readAliasName: "mytenant-jaeger-dependencies-read", + writeAliasName: "mytenant-jaeger-dependencies-write", + initialRolloverIndex: "mytenant-jaeger-dependencies-000001", + }, }, }, } diff --git a/plugin/storage/integration/es_index_cleaner_test.go b/plugin/storage/integration/es_index_cleaner_test.go index f30c05a993e..f284671b597 100644 --- a/plugin/storage/integration/es_index_cleaner_test.go +++ b/plugin/storage/integration/es_index_cleaner_test.go @@ -91,7 +91,7 @@ func TestIndexCleaner(t *testing.T) { envVars: []string{}, expectedIndices: []string{ archiveIndexName, - "jaeger-span-000001", "jaeger-service-000001", "jaeger-span-000002", "jaeger-service-000002", + "jaeger-span-000001", "jaeger-service-000001", "jaeger-dependencies-000001", "jaeger-span-000002", "jaeger-service-000002", "jaeger-dependencies-000002", "jaeger-span-archive-000001", "jaeger-span-archive-000002", }, }, @@ -100,7 +100,7 @@ func TestIndexCleaner(t *testing.T) { envVars: []string{"ROLLOVER=true"}, expectedIndices: []string{ archiveIndexName, spanIndexName, serviceIndexName, dependenciesIndexName, - "jaeger-span-000002", "jaeger-service-000002", + "jaeger-span-000002", "jaeger-service-000002", "jaeger-dependencies-000002", "jaeger-span-archive-000001", "jaeger-span-archive-000002", }, }, @@ -109,7 +109,7 @@ func TestIndexCleaner(t *testing.T) { envVars: []string{"ARCHIVE=true"}, expectedIndices: []string{ archiveIndexName, spanIndexName, serviceIndexName, dependenciesIndexName, - "jaeger-span-000001", "jaeger-service-000001", "jaeger-span-000002", "jaeger-service-000002", + "jaeger-span-000001", "jaeger-service-000001", "jaeger-dependencies-000001", "jaeger-span-000002", "jaeger-service-000002", "jaeger-dependencies-000002", "jaeger-span-archive-000002", }, }, diff --git a/plugin/storage/integration/es_index_rollover_test.go b/plugin/storage/integration/es_index_rollover_test.go index 7a78813da52..a3452b329e0 100644 --- a/plugin/storage/integration/es_index_rollover_test.go +++ b/plugin/storage/integration/es_index_rollover_test.go @@ -90,7 +90,7 @@ func runCreateIndicesWithILM(t *testing.T, ilmPolicyName string) { assert.Empty(t, indices) } else { - expectedIndices := []string{"jaeger-span-000001", "jaeger-service-000001"} + expectedIndices := []string{"jaeger-span-000001", "jaeger-service-000001", "jaeger-dependencies-000001"} t.Run(fmt.Sprintf("NoPrefix"), func(t *testing.T) { runIndexRolloverWithILMTest(t, client, "", expectedIndices, envVars, ilmPolicyName) }) @@ -101,7 +101,7 @@ func runCreateIndicesWithILM(t *testing.T, ilmPolicyName string) { } func runIndexRolloverWithILMTest(t *testing.T, client *elastic.Client, prefix string, expectedIndices, envVars []string, ilmPolicyName string) { - writeAliases := []string{"jaeger-service-write", "jaeger-span-write"} + writeAliases := []string{"jaeger-service-write", "jaeger-span-write", "jaeger-dependencies-write"} // make sure ES is cleaned before test cleanES(t, client, ilmPolicyName)