-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: Remove the need for external tools for managing ElasticSearch #6291
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Rohanraj123 <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6291 +/- ##
==========================================
- Coverage 96.20% 95.44% -0.77%
==========================================
Files 356 357 +1
Lines 20416 20596 +180
==========================================
+ Hits 19642 19658 +16
- Misses 585 748 +163
- Partials 189 190 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
||
// Validation function for Cleaner struct | ||
func (c *Cleaner) Validate() error { | ||
if c.Frequency <= 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.
validation can be declared in the field tags
type Cleaner struct { | ||
Enabled bool `mapstructure:"enabled"` | ||
Frequency time.Duration `mapstructure:"frequency"` | ||
IncludeArchive bool `mapstructure:"include_archive"` |
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.
in v2 archive storage is a separate instance, this property won't make sense
|
||
// ---- ES-specific config ---- | ||
// Cleaner holds the configuration for the Elasticsearch index Cleaner. | ||
Cleaner Cleaner `mapstructure:"cleaner"` |
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.
Cleaner Cleaner `mapstructure:"cleaner"` | |
IndexCleaner IndexCleaner `mapstructure:"index_cleaner"` |
@@ -585,3 +608,198 @@ func (c *Configuration) Validate() error { | |||
_, err := govalidator.ValidateStruct(c) | |||
return err | |||
} | |||
|
|||
// Run starts the cleaner that runs periodically based on the Frequency field. | |||
func (cfg *Configuration) RunCleaner() { |
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.
config package is for configuration, not for business logic. This should be somewhere in plugin/storage/es
} | ||
|
||
// deleteOldIndices deletes indices older than the configured MaxSpanAge. | ||
func (cfg *Configuration) deleteOldIndices() error { |
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.
doesn't this logic already exist in in cmd/es-index-cleaner? Why do we need to duplicate it?
@@ -24,6 +24,8 @@ func main() { | |||
command, | |||
) | |||
|
|||
internal.StartCleaner(v) |
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 enabled by config option, no need to "start" anything expicitly
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test