-
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
Add support for Elasticsearch ILM Polices #2454
Closed
Closed
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
bfb2e87
#2048 - Adds support for Elasticsearch ILM Polices
bhiravabhatla 6acf5da
#2048 - Fixes index templates to work well with Index prefixes
bhiravabhatla 17a8e1c
#2048 - Modify existing index templates to use ILM - avoid creating n…
bhiravabhatla 06896ec
Merge branch 'master' into master
bhiravabhatla 5f0dac7
#2048 - Fix perform_action method call by passing missing argument
bhiravabhatla f24f9fa
Merge branch 'master' into master
bhiravabhatla 09ba770
Merge branch 'master' into master
bhiravabhatla fe5938f
#2048[WIP] - Add support for enabling ILM using command line param
bhiravabhatla f02553e
#2048[WIP] - Rebasing with upstream master
bhiravabhatla 1af12df
#2048[WIP] - Fix lint issues
bhiravabhatla 0f5bb18
#2048[WIP] - Fix integration tests and remobe ES_USE_ILM parameter fr…
bhiravabhatla 8d3c483
#2048[WIP] - Fix failing es-otel-exporter-integration-test
bhiravabhatla e5fda11
#2048[WIP] - Implement suggested feedback and add integration test fo…
bhiravabhatla 016f626
Merge branch 'master' of https://github.com/jaegertracing/jaeger
bhiravabhatla f524da3
#2048[WIP] - Fix lint issues
bhiravabhatla 0076eaf
#2048[WIP] - Add write_index setting only if use_ilm is enabled & fix…
bhiravabhatla 653b861
#2048[WIP] - Fix failing exporter integration tests
bhiravabhatla 526f214
Update plugin/storage/es/options.go
bhiravabhatla 8a51584
2048[WIP] - Implement @albertteoh feedback on error variable names an…
bhiravabhatla fcbf676
Fix fmt issue
bhiravabhatla a3e8f0e
Fix misleading use-alias help doc (#2692)
albertteoh 8e0b750
#2048[WIP] - Fix failing build and implement feedback on escaping quotes
bhiravabhatla e2a0fee
#2048[WIP] - Add integration test to check index template names with …
bhiravabhatla 3f31372
#2048[WIP] - Add check to fail if delete ILM policy fails
bhiravabhatla aacf4c9
#2048[WIP] - Move Index rollover tests to another file
bhiravabhatla 77a8a17
#2048[WIP] - Skip TestIndexRollover_FailIfILMNotPresent test for es v…
bhiravabhatla 4755013
#2048[WIP] - Clean ES before running rollover test for ES version < 7
bhiravabhatla 667a511
Update plugin/storage/es/options.go
bhiravabhatla 3696256
#2048[WIP] - Replace external dependency for rendering templates with…
bhiravabhatla 4b044bc
Fix potential cross-site scripting issues (#2697)
yurishkuro 877175c
Remove 'Report Security Issue' link since GitHub already adds it prom…
yurishkuro f57c970
Add gh action for hotrod ci jobs (#2702)
Ashmita152 c514c91
Clean-up "tcollector" references (#2704)
sniperking1234 183af3c
Fix flaky TestHotReloadUIConfigTempFile (#2713)
albertteoh d1e9dc4
[pkg/queue] Add `StartConsumersWithFactory` function (#2714)
mx-psi 4c8ad45
[mem store] Return clones of spans to prevent in-place changes by adj…
bobrik 602b943
Show plaintext as supported Kafka auth option in CLI help (#2721)
pdepaepe 00b7daa
[agent] Add metrics to show connections status between agent and coll…
WalkerWang731 b980e87
[refactor] Minor clean-up of #2657 (#2728)
yurishkuro 5b80343
[tests] Increase timeout for TestGRPCResolverRoundRobin (#2729)
yurishkuro dc1b855
Add ability to use JS file for UI configuration (jaeger-ui/#123) (#2707)
th3M1ke 76256d6
Add support for Kafka SASL/PLAIN authentication via SCRAM-SHA-256 or …
WalkerWang731 1a888aa
#2048[WIP] - Fix fmt issues
bhiravabhatla 9bec1a4
#2048[WIP] - Implement feedback on CLI - use cobra & unit tests
bhiravabhatla 01654f9
Increase HotROD CI test timeout to 30sec
yurishkuro ea4e71c
Update jaeger-ui to use memoization for getConfig (#2732)
th3M1ke 23f53dd
Fix broken CNCF logo link
yurishkuro ef16c6a
TLS support for HTTP API of Query server (#2337)
rjs211 0f0cc90
Add ability to remove inactive maintainers; introduce Emeritus status…
yurishkuro d4895d7
Transition black-adder and tiffon to Emeritus Maintainers (#2735)
yurishkuro 6864653
Enable stale bot for PRs and questions (#2731)
yurishkuro 6f8bfb1
Expose cache ttl for es span writer index+service (#2737)
necrolyte2 d85d954
#2048[WIP] - Fix failing integration tests and lint
bhiravabhatla c0f3e93
#2048[WIP] - Fix fmt issues
bhiravabhatla 09e4e9d
#2048[WIP] - add tests to increase coverage
bhiravabhatla a3b465b
Fix merge conflicts
bhiravabhatla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (c) 2020 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package app | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Options represent configurable parameters for jaeger-templatizer | ||
type Options struct { | ||
Mapping string | ||
EsVersion int64 | ||
Shards int64 | ||
Replicas int64 | ||
EsPrefix string | ||
UseILM string // using string as util is being used in python and using bool leads to type issues. | ||
} | ||
|
||
const ( | ||
mappingFlag = "mapping" | ||
esVersionFlag = "esVersion" | ||
shardsFlag = "shards" | ||
replicasFlag = "replicas" | ||
esPrefixFlag = "esPrefix" | ||
useILMFlag = "useILM" | ||
) | ||
|
||
// AddFlags adds flags for templatizer main program | ||
func (o *Options) AddFlags(command *cobra.Command) { | ||
command.Flags().StringVarP( | ||
&o.Mapping, | ||
mappingFlag, | ||
"m", | ||
"", | ||
"Pass either jaeger-span or jaeger-service") | ||
command.Flags().Int64VarP( | ||
&o.EsVersion, | ||
esVersionFlag, | ||
"v", | ||
7, | ||
"the major Elasticsearch version") | ||
command.Flags().Int64VarP( | ||
&o.Shards, | ||
shardsFlag, | ||
"s", | ||
5, | ||
"the number of shards per index in Elasticsearch") | ||
command.Flags().Int64VarP( | ||
&o.Replicas, | ||
replicasFlag, | ||
"r", | ||
1, | ||
"the number of replicas per index in Elasticsearch") | ||
command.Flags().StringVarP( | ||
&o.EsPrefix, | ||
esPrefixFlag, | ||
"e", | ||
"", | ||
"specifies index prefix") | ||
command.Flags().StringVarP( | ||
&o.UseILM, | ||
useILMFlag, | ||
"u", | ||
"false", | ||
"set to true to use ILM for managing lifecycle of jaeger indices") | ||
|
||
// mark mapping flag as mandatory | ||
command.MarkFlagRequired(mappingFlag) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2020 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package app | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestOptionsWithDefaultFlags(t *testing.T) { | ||
o := Options{} | ||
c := cobra.Command{} | ||
o.AddFlags(&c) | ||
|
||
assert.Equal(t, "", o.Mapping) | ||
assert.Equal(t, int64(7), o.EsVersion) | ||
assert.Equal(t, int64(5), o.Shards) | ||
assert.Equal(t, int64(1), o.Replicas) | ||
assert.Equal(t, "", o.EsPrefix) | ||
assert.Equal(t, "false", o.UseILM) | ||
} | ||
|
||
func TestOptionsWithFlags(t *testing.T) { | ||
o := Options{} | ||
c := cobra.Command{} | ||
|
||
o.AddFlags(&c) | ||
c.ParseFlags([]string{ | ||
"--mapping=jaeger-span", | ||
"--esVersion=6", | ||
"--shards=5", | ||
"--replicas=1", | ||
"--esPrefix=test", | ||
"--useILM=true", | ||
}) | ||
|
||
assert.Equal(t, "jaeger-span", o.Mapping) | ||
assert.Equal(t, int64(6), o.EsVersion) | ||
assert.Equal(t, int64(5), o.Shards) | ||
assert.Equal(t, int64(1), o.Replicas) | ||
assert.Equal(t, "test", o.EsPrefix) | ||
assert.Equal(t, "true", o.UseILM) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) 2021 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package renderer | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/jaegertracing/jaeger/cmd/templatizer/app" | ||
esTemplate "github.com/jaegertracing/jaeger/pkg/es" | ||
"github.com/jaegertracing/jaeger/plugin/storage/es" | ||
) | ||
|
||
var fixMappingFunc = es.FixMapping | ||
var loadMappingFunc = es.LoadMapping | ||
var mapping string | ||
var err error | ||
|
||
// GetMappingAsString returns rendered index templates as string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest simplifying this to what's below. What's changed:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed this in new PR |
||
func GetMappingAsString(opt *app.Options) (string, error) { | ||
|
||
if opt.EsVersion == 7 { | ||
enableILM, err := strconv.ParseBool(opt.UseILM) | ||
if err != nil { | ||
return "", err | ||
} | ||
mapping, err = fixMappingFunc(esTemplate.TextTemplateBuilder{}, loadMappingFunc("/"+opt.Mapping+"-7.json"), opt.Shards, opt.Replicas, opt.EsPrefix, enableILM) | ||
if err != nil { | ||
return "", err | ||
} | ||
} else { | ||
mapping, err = fixMappingFunc(esTemplate.TextTemplateBuilder{}, loadMappingFunc("/"+opt.Mapping+".json"), opt.Shards, opt.Replicas, "", false) | ||
if err != nil { | ||
return "", err | ||
} | ||
} | ||
return mapping, nil | ||
|
||
} | ||
|
||
// IsValidOption checks if passed option is a valid index template. | ||
func IsValidOption(val string) bool { | ||
allowedValues := []string{"jaeger-span", "jaeger-service"} | ||
for _, value := range allowedValues { | ||
if val == value { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 looks like these stem from needing to mock out the function's behaviour. You've already done the hard work of creating interfaces and mocks for these, why not use them?
Consider removing these and please refer to the code suggestions below.